var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  return value;
};
import path from "path";
import { effectScope, isReactive, reactive, computed, defineComponent, createVNode, mergeProps, resolveDirective, unref, resolveDynamicComponent, useSSRContext, ref, resolveComponent, h, withCtx, withKeys, toDisplayString, openBlock, createBlock, createCommentVNode, watch, onMounted, render as render$1, nextTick, onActivated, onUnmounted, onDeactivated, isRef, getCurrentInstance, onBeforeUnmount, inject, provide, isVNode, Transition, withDirectives, vShow, withModifiers, renderSlot, Fragment, renderList, onServerPrefetch, onBeforeMount, KeepAlive, Suspense, createTextVNode, Teleport, createSSRApp } from "vue";
import { ssrRenderStyle, ssrRenderAttrs, ssrGetDirectiveProps, ssrRenderComponent, ssrRenderVNode, ssrRenderClass, ssrInterpolate, ssrRenderSlot, ssrRenderList, ssrRenderSuspense, renderToString } from "vue/server-renderer";
import { uniqWith, isEqual, isPlainObject } from "lodash-es";
import { defineStore, storeToRefs, createPinia } from "pinia";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc.js";
import qs from "qs";
import axios from "axios";
import { useRoute as useRoute$1, useRouter, onBeforeRouteUpdate, onBeforeRouteLeave, createRouter as createRouter$1, createMemoryHistory } from "vue-router";
import { useI18n, createI18n } from "vue-i18n";
import Big from "big.js/big.mjs";
import { useWindowSize, useEventListener as useEventListener$1 } from "@vueuse/core";
import { v4 } from "uuid";
import { fileURLToPath } from "url";
import { readFile } from "fs/promises";
const langs = [
  { name: "English", abbreviation: "en" },
  { name: "عربى", abbreviation: "ar" },
  { name: "Português", abbreviation: "pt" },
  { name: "Español", abbreviation: "es" },
  { name: "italiano", abbreviation: "it" },
  { name: "Deutsch", abbreviation: "de" },
  { name: "Français", abbreviation: "fr" },
  { name: "Nederlands", abbreviation: "nl" },
  { name: "svenska", abbreviation: "sv" },
  { name: "Ελληνικά", abbreviation: "el" },
  { name: "עִברִית", abbreviation: "he" },
  { name: "繁體中文", abbreviation: "zh" },
  { name: "日本語", abbreviation: "ja" },
  { name: "한국어", abbreviation: "ko" },
  { name: "ภาษาไทย", abbreviation: "th" }
];
const rtlLanguages = ["ar", "he"];
const useMainStore = defineStore("main", {
  state: () => ({
    ipSiteAbb: "us",
    ipCountryCode: "US",
    browserSiteAbb: "",
    browserCountryCode: "",
    siteAbb: "us",
    countryCode: "US",
    currencyCode: "USD",
    language: "en",
    countries: [],
    uuid: "",
    userAgent: "",
    documentTitle: "",
    initAppInfo: "",
    headerAdsHeight: 0,
    originHost: "",
    showLoginDialog: false,
    showFooter: true,
    // footer 展示隐藏
    abTestStr: ""
    // ABTest浏览分配实验格式化字符串 eg: ab_test_id1.A,ab_test_id2.X
  }),
  getters: {
    getCurrentCountry(state) {
      const country = state.countries.find((country2) => country2.country_abbreviation === state.countryCode);
      return country;
    },
    getCurrentCountryName() {
      const country = this.getCurrentCountry;
      return (country == null ? void 0 : country.country_name) || "";
    },
    getCountryCurrencies(state) {
      const country = this.getCurrentCountry;
      const countryIso = (country == null ? void 0 : country.country_iso_codes) || [];
      const currencies = countryIso.map((item) => {
        const iso = state.countries.find((country2) => country2.iso_code === item);
        return {
          iso_code: (iso == null ? void 0 : iso.iso_code) || "USD",
          self_to_usd_exchange_rate: (iso == null ? void 0 : iso.self_to_usd_exchange_rate) || 1,
          usd_to_self_exchange_rate: (iso == null ? void 0 : iso.usd_to_self_exchange_rate) || 1
        };
      });
      return currencies || [];
    },
    getCountryLanguages(state) {
      const country = this.getCurrentCountry;
      return (country == null ? void 0 : country.country_languages) || [];
    },
    getCurrencyMap(state) {
      const result = state.countries.reduce((res, country) => {
        const isoCode = (country == null ? void 0 : country.iso_code) || "USD";
        return Object.assign(res, {
          [isoCode]: {
            iso_code: country == null ? void 0 : country.iso_code,
            self_to_usd_exchange_rate: country == null ? void 0 : country.self_to_usd_exchange_rate,
            usd_to_self_exchange_rate: country == null ? void 0 : country.usd_to_self_exchange_rate
            // symbolDisplay: country?.symbol_display,
            // symbolPosition: country?.position || 0,
            // decimalSymbol: country?.decimal_point_style || ".",
            // thousandSeparator: country?.separator || ""
          }
        });
      }, {});
      return result;
    },
    getCountryCurrency(state) {
      return state.currencyCode;
    },
    getCurrencies(state) {
      const currencies = uniqWith(
        state.countries.map((country) => {
          return {
            iso_code: (country == null ? void 0 : country.iso_code) || "USD",
            self_to_usd_exchange_rate: (country == null ? void 0 : country.self_to_usd_exchange_rate) || 1,
            usd_to_self_exchange_rate: (country == null ? void 0 : country.usd_to_self_exchange_rate) || 1
          };
        }),
        isEqual
      );
      return currencies;
    },
    getLocales(state) {
      return `${state.language}-${state.countryCode}`;
    },
    /** @description 获取对应实验ID的ABTest实验分配变体 */
    getABTestExperiment(state) {
      return (eid, defaultVariation = "X") => {
        const abTestArr = state.abTestStr.split(",");
        const abTest = abTestArr.find((item) => item.split(".")[0] === eid);
        let abTestVariation = defaultVariation;
        if (abTest) {
          abTestVariation = abTest.split(".")[1];
        }
        return abTestVariation;
      };
    },
    /**
     * @description 获取所有ABTest 实验及实验分配变体
     */
    getABTestExperiments(state) {
      return (isObj = true) => {
        const abTestArr = state.abTestStr ? state.abTestStr.split(",") : [];
        if (isObj) {
          const experiments = abTestArr.reduce((res, item) => {
            const abTestSplit = item.split(".");
            if (abTestSplit.length >= 2) {
              return res.concat({
                experiment_id: abTestSplit[0],
                variation_id: abTestSplit[1]
              });
            }
            return res;
          }, []);
          return JSON.stringify(experiments);
        } else {
          return JSON.stringify(abTestArr);
        }
      };
    },
    /** @description SEO 站点 tdk */
    seoPatPatTdk(state) {
      const siteAbb = state.siteAbb;
      const patpatTdk = {
        us: "PatPat US",
        uk: "PatPat UK",
        au: "PatPat AU",
        es: "PatPat ES",
        mx: "PatPat MX",
        fr: "PatPat FR",
        br: "PatPat BR",
        de: "PatPat DE",
        hk: "PatPat HK",
        it: "PatPat IT",
        ar: "بات بات",
        tr: "PatPat TR",
        ru: "PatPat RU",
        nl: "PatPat NL",
        pl: "PatPat PL",
        se: "PatPat SE",
        gr: "PatPat GR",
        pt: "PatPat PT",
        ca: "PatPat CA",
        eur: "PatPat EUR",
        asia: "PatPat ASIA"
      };
      return patpatTdk[siteAbb] || "Patpat.com";
    },
    isRtl(state) {
      return rtlLanguages.includes(state.language);
    }
  },
  actions: {
    initMainStore(context) {
      this.siteAbb = context.siteInfo.siteAbb;
      this.ipSiteAbb = context.siteInfo.ipSiteAbb;
      this.language = context.siteInfo.currentLang;
      this.countries = context.siteInfo.countriesMap;
      this.countryCode = context.siteInfo.countryCode;
      this.ipCountryCode = context.siteInfo.ipCountryCode;
      this.currencyCode = context.siteInfo.currencyCode;
      this.browserSiteAbb = context.siteInfo.browserSiteAbb;
      this.browserCountryCode = context.siteInfo.browserCountryCode;
      this.originHost = context.siteInfo.originHost;
      this.uuid = context.uuid;
      this.userAgent = context.userAgent;
      this.documentTitle = context.title;
      this.abTestStr = context.abTestStr;
    },
    changeLanguage(dataLocale) {
      this.language = dataLocale;
    },
    setHeaderAdsHeight(height) {
      this.headerAdsHeight = height;
    },
    changeFooterState(state) {
      this.showFooter = state;
    }
  }
});
const ipVerify = /^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\:\d{2,5})?$/;
dayjs.extend(utc);
const getRootDomain = () => {
  if (window.location.hostname === "localhost")
    return "localhost";
  if (ipVerify.test(window.location.hostname)) {
    return window.location.hostname;
  }
  return "." + window.location.hostname.split(".").slice(-2).join(".");
};
const getQueryString = (name2, searchTarget) => {
  name2 = name2.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
  const regex = new RegExp("[\\?&]" + name2 + "=([^&#]*)");
  const results = regex.exec(searchTarget || location.search);
  return results && results[1] ? decodeURIComponent(results[1].replace(/\+/g, " ")) : "";
};
function replaceImageSrcToCdnUrl(html = "", size = "375x0", isSupportWebp = true) {
  if (typeof html !== "string")
    return html;
  const imgReg = /<img.*?(?:>|\/>)/gi;
  const srcReg = /src=['"]?([^'"]*)['"]?/i;
  return html.replace(imgReg, (imgTag) => {
    return imgTag.replace(srcReg, (src, url) => {
      return src.replace(url, cdnUrl({ url, size, isSupportWebp }));
    });
  });
}
function cdnUrl({
  url,
  size = "",
  type = "",
  isSupportWebp = true
}) {
  const cdnMaps = [
    "img.yfsassets.com",
    "www.patpat.com",
    "img.ppwebstatic.com",
    "cdn.patpat.shop",
    "patpatasset.s3.amazonaws.com",
    "patpatdev.img.patpat.com",
    "patpatdev.s3.amazonaws.com",
    "patpatdev.s3-us-west-1.amazonaws.com",
    "patpatdev.s3.us-west-1.amazonaws.com",
    "s3-us-west-1.amazonaws.com",
    "patpatdevtest.s3.us-west-2.amazonaws.com",
    "patpatwebstatic.s3-us-west-2.amazonaws.com",
    "patpatwebstatic.s3.us-west-2.amazonaws.com"
  ];
  const belongToPatpat = cdnMaps.find((item) => url.indexOf(item) > -1);
  if (!belongToPatpat)
    return url;
  url = url.replace(/(?:\/)?((?:\d+x)?\d+)$/, function(_2, $1) {
    size = size.length ? size : $1;
    return "";
  });
  const isGif = /\.gif$/i.test(url);
  const isTiff = /\.tif?f$/i.test(url);
  if (size && "https://image.yfswebstatic.com") {
    size = size.split("x").map((n) => Number(n) * 2).join("x");
  }
  let imageCDN = "https://image-no-awscf.yfswebstatic.com";
  {
    if (!isSupportWebp) {
      imageCDN = "https://image-no-webp.yfswebstatic.com";
    } else {
      imageCDN = "https://image.yfswebstatic.com";
    }
    if (!isGif) {
      imageCDN += type === "original" ? "" : "/fit-in";
      imageCDN += /^\d+x\d+$/.test(size) ? `/${size}` : "";
    }
    if (isTiff) {
      imageCDN += "/filters:format(jpeg)";
    }
  }
  url = url.replace(/^https?:\/\//, "").replace(belongToPatpat, imageCDN);
  return url;
}
const base64Encode = (str) => {
  let c1, c2, c3;
  const base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  let i = 0;
  const len = str.length;
  let string = "";
  while (i < len) {
    c1 = str.charCodeAt(i++) & 255;
    if (i === len) {
      string += base64EncodeChars.charAt(c1 >> 2);
      string += base64EncodeChars.charAt((c1 & 3) << 4);
      string += "==";
      break;
    }
    c2 = str.charCodeAt(i++);
    if (i === len) {
      string += base64EncodeChars.charAt(c1 >> 2);
      string += base64EncodeChars.charAt((c1 & 3) << 4 | (c2 & 240) >> 4);
      string += base64EncodeChars.charAt((c2 & 15) << 2);
      string += "=";
      break;
    }
    c3 = str.charCodeAt(i++);
    string += base64EncodeChars.charAt(c1 >> 2);
    string += base64EncodeChars.charAt((c1 & 3) << 4 | (c2 & 240) >> 4);
    string += base64EncodeChars.charAt((c2 & 15) << 2 | (c3 & 192) >> 6);
    string += base64EncodeChars.charAt(c3 & 63);
  }
  return string;
};
const uctTime = (time) => {
  const times = time.replace(/[-]/g, "/");
  const endY = new Date(times).getFullYear();
  const endM = new Date(times).getMonth();
  const endD = new Date(times).getDate();
  const endH = new Date(times).getHours();
  const endMM = new Date(times).getMinutes();
  const endS = new Date(times).getSeconds();
  return Date.UTC(endY, endM, endD, endH, endMM, endS);
};
const getLocalUtcDate = (milliseconds, isShowHMS = true) => {
  const dt = milliseconds ? new Date(milliseconds) : /* @__PURE__ */ new Date();
  const yy = dt.getUTCFullYear();
  const mm = dt.getUTCMonth() + 1;
  const dd = dt.getUTCDate();
  const hh = dt.getUTCHours();
  const mt = dt.getUTCMinutes();
  const ss = dt.getUTCSeconds();
  const ymd = `${yy}-${mm < 10 ? "0" + mm : mm}-${dd < 10 ? "0" + dd : dd}`;
  const hms = `${String(hh).padStart(2, "0")}:${String(mt).padStart(2, "0")}:${String(ss).padStart(2, "0")}`;
  if (isShowHMS) {
    return ymd + " " + hms;
  } else {
    return ymd;
  }
};
function transformUTCToLocal(time, format = "YYYY-MM-DD HH:mm:ss") {
  const dayjsObj = dayjs.utc(time);
  return dayjsObj.isValid() ? dayjsObj.local().format(format) : time;
}
const discountCalculation = (nowPrice, oldPrice) => {
  const nowP = Number(nowPrice);
  const oldP = Number(oldPrice);
  const dis = Math.round((nowP - oldP) / oldP * 100);
  return dis === 0 || dis.toString() === "NaN" || nowP > oldP ? "" : dis + "%";
};
const checkIsJSON = (str) => {
  if (typeof str === "string") {
    try {
      const obj = JSON.parse(str);
      if (typeof obj === "object" && obj) {
        return true;
      } else {
        return false;
      }
    } catch (e) {
      return false;
    }
  }
  return false;
};
const setCookie = (name2, value, day = 30, domain, path2 = "/") => {
  const exp = /* @__PURE__ */ new Date();
  exp.setDate(exp.getDate() + day);
  domain = domain || window.location.hostname;
  if (typeof value !== "string") {
    value = JSON.stringify(value);
  }
  document.cookie = `${name2}=${escape(value)};domain=${domain};expires=${exp.toUTCString()};path=${path2}`;
};
const getCookie = (name2, decode = true) => {
  let arr;
  const reg = new RegExp("(^| )" + name2 + "=([^;]*)(;|$)");
  if (arr = document.cookie.match(reg)) {
    let ls = unescape(arr[2]);
    if (decode) {
      ls = decodeURIComponent(ls);
    }
    if (isPlainObject(ls)) {
      ls = JSON.parse(ls);
    }
    return ls;
  } else {
    return "";
  }
};
const setRootDomainCookie = (name2, value, day = 30, path2 = "/") => {
  const rootDomain = getRootDomain();
  setCookie(name2, value, day, rootDomain, path2);
};
const delRootDomainCookie = (name2, path2 = "/") => {
  const rootDomain = getRootDomain();
  document.cookie = `${name2}=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=${path2};domain=${rootDomain}`;
};
class APIAxios {
  constructor(config) {
    __publicField(this, "instance");
    __publicField(this, "removeRepeat");
    __publicField(this, "abortControllers", /* @__PURE__ */ new Map());
    this.instance = axios.create(config);
    this.removeRepeat = !!(config == null ? void 0 : config.removeRepeat);
    if (this.removeRepeat) {
      const requestInterceptor = (config2) => {
        this.removePending(config2);
        this.addPending(config2);
        return config2;
      };
      const responseInterceptor = (response) => {
        this.removePending(response.config);
        return response;
      };
      const responseInterceptorCatch = (error) => {
        error.config && this.removePending(error.config);
        return Promise.reject(error);
      };
      this.use({ requestInterceptor, responseInterceptor, responseInterceptorCatch });
    }
    (config == null ? void 0 : config.interceptors) && this.use(config == null ? void 0 : config.interceptors);
  }
  request(config) {
    return new Promise((resolve2, reject) => {
      var _a, _b;
      if ((_a = config.interceptors) == null ? void 0 : _a.requestInterceptor)
        config = (_b = config.interceptors) == null ? void 0 : _b.requestInterceptor(config);
      if (config.removeRepeat && !this.removeRepeat) {
        this.removePending(config);
        this.addPending(config);
      }
      this.instance.request(config).then((res) => {
        var _a2, _b2;
        if ((_a2 = config.interceptors) == null ? void 0 : _a2.responseInterceptor)
          res = (_b2 = config.interceptors) == null ? void 0 : _b2.responseInterceptor(res);
        resolve2(res);
      }).catch((err) => {
        reject(err);
      }).finally(() => {
        if (config.removeRepeat && !this.removeRepeat)
          this.removePending(config);
      });
    });
  }
  get(config) {
    return this.request({ ...config, method: "GET" });
  }
  post(config) {
    return this.request({ ...config, method: "POST" });
  }
  delete(config) {
    return this.request({ ...config, method: "DELETE" });
  }
  patch(config) {
    return this.request({ ...config, method: "PATCH" });
  }
  head(config) {
    return this.request({ ...config, method: "HEAD" });
  }
  options(config) {
    return this.request({ ...config, method: "OPTIONS" });
  }
  put(config) {
    return this.request({ ...config, method: "PUT" });
  }
  use(interceptors) {
    this.instance.interceptors.request.use(interceptors == null ? void 0 : interceptors.requestInterceptor, interceptors == null ? void 0 : interceptors.requestInterceptorCatch);
    this.instance.interceptors.response.use(interceptors == null ? void 0 : interceptors.responseInterceptor, interceptors == null ? void 0 : interceptors.responseInterceptorCatch);
  }
  /** ******* 根据配置提供是否删除重复请求  **********/
  /**
   * 生成每个请求唯一的键
   */
  getPendingKey(config) {
    let { data } = config;
    const { url, method, params } = config;
    if (typeof data === "string")
      data = JSON.parse(data);
    return [url, method, JSON.stringify(params), JSON.stringify(data)].join("&");
  }
  /**
   * 储存每个请求唯一值, 也就是cancel()方法, 用于取消请求
   */
  addPending(config) {
    const pendingKey = this.getPendingKey(config);
    config.cancelToken = config.cancelToken || new axios.CancelToken((cancel) => {
      if (!this.abortControllers.has(pendingKey))
        this.abortControllers.set(pendingKey, cancel);
    });
  }
  /**
   * 删除重复的请求
   */
  removePending(config) {
    const pendingKey = this.getPendingKey(config);
    if (this.abortControllers.has(pendingKey)) {
      const cancelToken = this.abortControllers.get(pendingKey);
      cancelToken(pendingKey);
      this.abortControllers.delete(pendingKey);
    }
  }
}
const useNativeInfoStore = defineStore("nativeInfo", {
  state: () => ({
    currencyCode: "",
    isIos: false,
    isAndroid: false,
    appNavVersion: "",
    pin: "",
    token: "",
    userId: 0,
    country: "",
    // 国家名称
    siteAbb: "",
    // 站点
    currencyInfo: {},
    // 货币信息
    appVersion: "",
    isLogin: false,
    experiments: "",
    // app实验参数
    language: "en",
    // app语言
    deviceID: "",
    // 设备ID
    adlinkId: "",
    // adlk_id
    adyen3Dinfo: "",
    appBuildVersion: "",
    countryCode: "",
    // 国家码
    email: "",
    homePosition: "",
    lastUrl: "",
    pagePosition: "",
    lastTid: "",
    lastPagePositionId: "",
    // -- 新规则埋点坑位
    lastPagePositionContent: "",
    // -- 新规则埋点坑位内容
    rootPagePositionId: "",
    //  -- 新规则埋点坑位， 内容可复用HOME_POSITION_CONTENT
    platform: "wap",
    // ios | android | wap
    timeZone: "",
    // GTM+8
    timeZoneName: "",
    // Asia/Shanghai
    isReminded: false,
    statusBarHeight: 0,
    // ios app状态栏高度， 安卓暂时没有
    TID: "",
    isFromApp: false,
    homePositionContent: "",
    // app 6.9才支持这两个字段
    pagePositionContent: "",
    appVersionNumber: 0,
    // app数字版本号
    sessionId: "",
    // app的session_id,7.5版本才支持
    pageViewTime: 0,
    // app的page_view_time,7.5版本才支持
    iphoneStatebarHeight: 0,
    // iphone 状态栏高度 7.7.6版本才支持 （之前的不准，ios开发说是写死的，现在这个是动态获取的）
    iphoneBottomSafeHeight: 0
    // iphone 底部安全区域高度 7.7.6版本才支持
  }),
  getters: {
    getAppExperiment() {
      return (eid, defaultVariation = "X") => {
        var _a;
        const abTestArr = this.experiments.split(",");
        const abTest = abTestArr.find((item) => item.split(".")[0] === eid);
        let abTestVariation = defaultVariation;
        if (abTest) {
          abTestVariation = ((_a = abTest.split(".")[1]) == null ? void 0 : _a.toUpperCase()) || defaultVariation;
        }
        return abTestVariation;
      };
    }
  },
  actions: {
    initStore(data) {
      const route2 = useRoute$1();
      const queryPlatform = route2.query && route2.query.platform ? route2.query.platform : "";
      let isQueryPlatform = false;
      if (queryPlatform === "app" || Array.isArray(queryPlatform) && queryPlatform.includes("app")) {
        isQueryPlatform = true;
      }
      if (data && typeof data === "string") {
        data = decodeURIComponent(data);
        if (checkIsJSON(data)) {
          const PatPat = JSON.parse(data) || {};
          this.getNativeInfo(PatPat);
        }
      }
      if (!this.isFromApp) {
        this.isFromApp = isQueryPlatform;
      }
    },
    /**
     * @desc 获取实时的内嵌h5信息
     * @param PatPat
     * @returns {NativeInfo} app基本信息
     */
    getNativeInfo(PatPat) {
      let nav = {};
      const u = this.getPatPatKey(nav, "userAgent", "");
      const platform2 = this.getPatPatKey(PatPat, "PLATFORM", this.platform);
      const isAndroid2 = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1 || platform2 === "android";
      const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) || platform2 === "ios";
      let currencyInfo = this.getPatPatKey(PatPat, "APP_CURRENCY_INFO", this.currencyInfo);
      let currencyCode = this.currencyCode;
      if (typeof currencyInfo === "object") {
        currencyInfo = currencyInfo;
      } else if (checkIsJSON(currencyInfo)) {
        currencyInfo = JSON.parse(currencyInfo);
      }
      if (currencyInfo.currencyCode) {
        currencyCode = currencyInfo.currencyCode;
      }
      const nativeInfo = {
        currencyCode,
        isIos: isiOS,
        isAndroid: isAndroid2,
        appNavVersion: this.getPatPatKey(nav, "appVersion", ""),
        pin: this.getPatPatKey(PatPat, "PIN", this.pin),
        token: this.getPatPatKey(PatPat, "USER_TOKEN", ""),
        userId: Number(this.getPatPatKey(PatPat, "USER_ID", 0)),
        country: this.getPatPatKey(PatPat, "SETTING_COUNTRY", this.country),
        // 国家名称
        siteAbb: this.getPatPatKey(PatPat, "SITE_ABB", this.siteAbb),
        // 站点
        currencyInfo,
        // 货币信息
        appVersion: this.getPatPatKey(PatPat, "APP_VERSION", this.appVersion),
        isLogin: !!this.getPatPatKey(PatPat, "IS_LOGIN", this.isLogin),
        experiments: this.getPatPatKey(PatPat, "PATPAT_EXPERIMENTS", this.experiments),
        // app实验参数
        language: this.getPatPatKey(PatPat, "LANGUAGE", this.language),
        // app语言
        deviceID: this.getPatPatKey(PatPat, "DEVICE_ID", this.deviceID),
        // 设备ID
        adlinkId: this.getPatPatKey(PatPat, "ADLINK_ID", this.adlinkId),
        // adlk_id
        adyen3Dinfo: this.getPatPatKey(PatPat, "ADYEN_3DINFO", this.adyen3Dinfo),
        appBuildVersion: this.getPatPatKey(PatPat, "APP_BUILDVERSION", this.appBuildVersion),
        countryCode: this.getPatPatKey(PatPat, "COUNTRY", this.countryCode),
        // 国家码
        email: this.getPatPatKey(PatPat, "EMAIL", this.email),
        homePosition: this.getPatPatKey(PatPat, "HOME_POSITION", this.homePosition),
        lastUrl: this.getPatPatKey(PatPat, "LAST_URL", this.lastUrl),
        pagePosition: this.getPatPatKey(PatPat, "PAGE_POSITION", this.pagePosition),
        lastTid: this.getPatPatKey(PatPat, "LAST_TID", this.lastTid),
        lastPagePositionId: this.getPatPatKey(PatPat, "LAST_PAGE_POSITION_ID", this.lastPagePositionId),
        // -- 新规则埋点坑位
        lastPagePositionContent: this.getPatPatKey(PatPat, "LAST_PAGE_POSITION_CONTENT", this.lastPagePositionContent),
        // -- 新规则埋点坑位内容
        rootPagePositionId: this.getPatPatKey(PatPat, "ROOT_PAGE_POSITION_ID", this.rootPagePositionId),
        //  -- 新规则埋点坑位， 内容可复用HOME_POSITION_CONTENT
        platform: platform2,
        // ios | android | wap
        timeZone: this.getPatPatKey(PatPat, "TIMEZONE", this.timeZone),
        // GTM+8
        timeZoneName: this.getPatPatKey(PatPat, "TIMEZONE_NAME", this.timeZoneName),
        // Asia/Shanghai
        isReminded: !!this.getPatPatKey(PatPat, "SYSTEM_PUSH_STATUS", this.isReminded),
        statusBarHeight: this.getPatPatKey(PatPat, "IPHONESTATEBARHEIGHT", this.statusBarHeight),
        // ios app状态栏高度， 安卓暂时没有
        TID: this.getPatPatKey(PatPat, "TID", this.TID),
        isFromApp: platform2 === "ios" || platform2 === "android" || this.isFromApp,
        homePositionContent: this.getPatPatKey(PatPat, "HOME_POSITION_CONTENT", this.homePositionContent),
        // app 6.9才支持这两个字段
        pagePositionContent: this.getPatPatKey(PatPat, "PAGE_POSITION_CONTENT", this.pagePositionContent),
        appVersionNumber: this.appVersionNumber,
        // app数字版本号
        sessionId: this.getPatPatKey(PatPat, "SESSION_ID", this.sessionId),
        // app的session_id,7.5版本才支持
        pageViewTime: this.getPatPatKey(PatPat, "PAGE_VIEW_TIME", this.pageViewTime),
        // app的page_view_time,7.5版本才支持
        iphoneStatebarHeight: this.getPatPatKey(PatPat, "IPHONE_STATEBAR_HEIGHT", this.iphoneStatebarHeight),
        // iphone 状态栏高度 7.7.6版本才支持 （之前的不准，ios开发说是写死的，现在这个是动态获取的）
        iphoneBottomSafeHeight: this.getPatPatKey(PatPat, "IPHONE_BOTTOM_SAFE_HEIGHT", this.iphoneBottomSafeHeight)
        // iphone 底部安全区域高度 7.7.6版本才支持
      };
      try {
        const lang = nativeInfo.language.includes("-") ? nativeInfo.language.split("-")[0] : nativeInfo.language;
        if (lang) {
          nativeInfo.language = lang;
        }
        nativeInfo.statusBarHeight = nativeInfo.statusBarHeight - 0;
        nativeInfo.appVersionNumber = Number(
          String(nativeInfo.appVersion).split(".").reduce((item1, item2, index2) => index2 === 1 ? item1 + "." + item2 : item1 + item2)
        );
        this.upDataStore(nativeInfo);
        return nativeInfo;
      } catch (err) {
        console.log(err);
        this.upDataStore(nativeInfo);
        return nativeInfo;
      }
    },
    getPatPatKey(o, k, df) {
      if (o && typeof o === "object") {
        return Reflect.get(o, k) || df;
      }
      return df;
    },
    upDataStore(nativeInfo) {
      this.isIos = nativeInfo.isIos;
      this.isAndroid = nativeInfo.isAndroid;
      this.pin = nativeInfo.pin;
      this.token = nativeInfo.token;
      this.userId = nativeInfo.userId;
      this.country = nativeInfo.country;
      this.siteAbb = nativeInfo.siteAbb;
      this.currencyInfo = nativeInfo.currencyInfo;
      this.currencyCode = nativeInfo.currencyCode;
      this.appVersion = nativeInfo.appVersion;
      this.isLogin = nativeInfo.isLogin;
      this.experiments = nativeInfo.experiments;
      this.language = nativeInfo.language;
      this.deviceID = nativeInfo.deviceID;
      this.adlinkId = nativeInfo.adlinkId;
      this.adyen3Dinfo = nativeInfo.adyen3Dinfo;
      this.appBuildVersion = nativeInfo.appBuildVersion;
      this.countryCode = nativeInfo.countryCode;
      this.email = nativeInfo.email;
      this.homePosition = nativeInfo.homePosition;
      this.lastUrl = nativeInfo.lastUrl;
      this.pagePosition = nativeInfo.pagePosition;
      this.lastPagePositionId = nativeInfo.lastPagePositionId;
      this.lastPagePositionContent = nativeInfo.lastPagePositionContent;
      this.rootPagePositionId = nativeInfo.rootPagePositionId;
      this.platform = nativeInfo.platform;
      this.timeZone = nativeInfo.timeZone;
      this.timeZoneName = nativeInfo.timeZoneName;
      this.isReminded = nativeInfo.isReminded;
      this.statusBarHeight = nativeInfo.statusBarHeight;
      this.TID = nativeInfo.TID;
      this.isFromApp = nativeInfo.isFromApp;
      this.homePositionContent = nativeInfo.homePositionContent;
      this.pagePositionContent = nativeInfo.pagePositionContent;
      this.sessionId = nativeInfo.sessionId;
      this.pageViewTime = nativeInfo.pageViewTime;
      this.iphoneStatebarHeight = nativeInfo.iphoneStatebarHeight;
      this.iphoneBottomSafeHeight = nativeInfo.iphoneBottomSafeHeight;
      this.appVersionNumber = nativeInfo.appVersionNumber;
    },
    getAppTestExperiment(eid) {
    }
  }
});
const ServerApi = () => new APIAxios({
  baseURL: process.env.VITE_API_BASE_URL,
  headers: {
    accept: "*/*",
    "content-type": "application/x-www-form-urlencoded"
  },
  timeout: 59e3,
  withCredentials: false,
  removeRepeat: false,
  interceptors: {
    requestInterceptor: (config) => {
      const currentMethod = config.method ? config.method.toLocaleLowerCase() : "";
      const { siteAbb, language, uuid, currencyCode, getCurrentCountryName, userAgent } = useMainStore();
      const nativeInfo = useNativeInfoStore();
      const { token } = useUserInfoStore();
      if (config.headers) {
        config.headers.abb = language === "zh" ? "zh-tw" : language;
        config.headers.pagecurrency = currencyCode;
        config.headers["patpat-platform"] = "wap";
        config.headers["site-abb"] = siteAbb;
        config.headers["pp-country-name"] = getCurrentCountryName || "";
        config.headers["user-agent"] = userAgent || "undefined";
        config.headers["is-new-web-version"] = 1;
        config.headers.token = token || "guest";
        config.headers["unique-session-id"] = uuid || "";
        if (nativeInfo.isFromApp) {
          config.headers["token"] = nativeInfo.token || "guest";
          config.headers["deviceid"] = nativeInfo.deviceID;
          config.headers["appversion"] = nativeInfo.appVersion;
          config.headers["platform"] = nativeInfo.platform;
        }
      }
      const reqMethods = ["post", "put", "delete"];
      if (reqMethods.includes(currentMethod)) {
        if (Object.prototype.toString.call(config.data) !== "[object FormData]") {
          config.data = qs.stringify(config.data);
        }
      }
      if (config.loading)
        ;
      return config;
    },
    responseInterceptor: (response) => {
      const data = response.data;
      switch (data.code || data.status) {
        case 200:
          return data.data || data.content;
        case 403:
          break;
        default:
          const resError = new Error(data.msg || data.message);
          resError.code = data.code || data.status;
          return Promise.reject(resError);
      }
      return response;
    },
    responseInterceptorCatch: (err) => {
      if (err && err.response) {
        switch (err.response.status) {
          case 400:
            err.message = "Bad Request";
            break;
          case 403:
            err.message = "Forbidden";
            break;
          case 404:
            err.message = "Not Found";
            break;
          case 500:
            err.message = "Internal Server Error";
            break;
          default:
            err.message = `Connection error ${err.status}`;
        }
      } else {
        if (err.message.indexOf("timeout") !== -1) {
          err = { status: 503, message: "The network connection is temporarily unavailable. Please refresh the page and try again." };
        } else if (err.message.indexOf("canceled") !== -1) {
          err.status = 400;
        }
      }
      console.log(err);
      return err;
    }
  }
});
const api$1 = ServerApi();
const guestLogin = (params) => {
  return api$1.post({
    url: "/v2/users/guest/login",
    params
  });
};
const getUserInfo = (params) => {
  return api$1.get({
    url: "/v2/users/token/user_info",
    params
  });
};
const usersFavorites = (params) => {
  return api$1.get({
    url: "/v2/users/favorites",
    params
  });
};
const getUserNavigationApi = (params = {}) => {
  return api$1.get({
    params,
    url: "/v2/common/navigation_info"
  });
};
const useUserInfoStore = defineStore("userInfo", {
  state: () => ({
    token: "",
    userId: 0,
    isNewUser: 1,
    realCountry: "",
    loginStatus: false,
    userFavorites: [],
    // 用户收藏商品列表
    collectFavProduct: null,
    // 点击收藏的商品信息
    isNewFavorites: false,
    // 点击成功收藏商品状态
    favorite: {
      favoriteList: [],
      noMore: false,
      pageIndex: 0
    }
  }),
  getters: {},
  actions: {
    setUserInfo(data) {
      let day = 365;
      if (data.email) {
        setRootDomainCookie("user_email", data.email);
        day = 30;
      }
      this.token = data.token;
      this.userId = data.user_id;
      this.isNewUser = data.is_new_user;
      this.loginStatus = (data == null ? void 0 : data.status) || getCookie("loginStatus");
      setRootDomainCookie("token", data.token, day);
      setRootDomainCookie("userId", data.user_id, day);
      setRootDomainCookie("loginStatus", this.loginStatus, day);
    },
    // 修改用户收藏品列表 SET_USER_FAVORITES
    setUserFavorites(products) {
      this.userFavorites = products;
    },
    // 获取用户所有收藏商品Id列表
    getUserAllFavoriteIdList() {
      try {
        const params = {
          offset: 0,
          page_size: 500
        };
        usersFavorites(params).then((res) => {
          const favoriteIdList = res.map((product) => product.product_id);
          this.setUserFavorites(favoriteIdList);
        });
        return;
      } catch (error) {
        console.log("getUserAllFavoriteIdList error:", error);
        return Promise.reject(error);
      }
    },
    // 分类页点击的收藏的商品信息 SET_FAV_PRODUCT
    setFavProduct(product) {
      this.collectFavProduct = product;
    },
    // UPDATE_FAVORITE
    updateFavorite({ key, value }) {
      const hasOwnProperty = Object.prototype.hasOwnProperty.call(this.favorite, key);
      if (hasOwnProperty)
        this.favorite[key] = value;
    },
    // SET_NEW_FAVORITES_STATUS
    setNewFavoritesStatus(data) {
      this.isNewFavorites = data;
    },
    async getUserNavigation() {
      try {
        const data = await getUserNavigationApi();
        this.realCountry = data.real_country;
        if (false)
          ;
        return data;
      } catch (err) {
        console.log("error func=getUserNavigation api=userNavigation", err);
      }
    }
  }
});
const currencyMap = {
  // 货币
  currency: [
    {
      locales: ["DKK"],
      fix_locales: "en-DK"
    },
    {
      locales: ["NOK"],
      fix_locales: "sv-NO"
    },
    {
      locales: ["SGD"],
      fix_locales: "pt-SG"
    },
    {
      locales: ["USD", "CAD"],
      fix_locales: "en-US"
    }
  ],
  // 国家货币
  countryCurrency: [
    {
      locales: ["AU-AUD"],
      fix_locales: "zh-AU"
    },
    {
      locales: ["IT-EUR"],
      fix_locales: "es-IT"
    }
  ],
  // 国家语言
  countryLangs: [
    {
      locales: [
        "en-AU",
        "en-BS",
        "en-FJ",
        "en-GM",
        "en-GH",
        "en-JM",
        "en-MU",
        "en-LC",
        "en-WS",
        "en-SC",
        "en-SI",
        "en-SZ",
        "fr-TJ",
        "fr-TG",
        "en-TT",
        "en-TV",
        "en-ZM"
      ],
      fix_locales: "en-US"
    },
    {
      locales: [
        "en-BH",
        "en-EG",
        "en-IQ",
        "en-JO",
        "en-KW",
        "de-LY",
        "en-OM",
        "en-QA",
        "en-SA",
        "ar-BH",
        "ar-TD",
        "ar-EG",
        "ar-IQ",
        "ar-IL",
        "ar-JO",
        "ar-KW",
        "ar-LB",
        "ar-OM",
        "ar-QA",
        "ar-SA"
      ],
      fix_locales: "ar-US"
    },
    {
      locales: ["de-CL", "en-CL", "en-CO", "en-AR"],
      fix_locales: "es-CL"
    },
    {
      locales: ["en-NL", "fr-NL", "nl-NL"],
      fix_locales: "es-NL"
    },
    {
      locales: ["en-CN"],
      fix_locales: "zh-CN"
    },
    {
      locales: ["de-CR"],
      fix_locales: "es-CR"
    },
    {
      locales: ["en-DO"],
      fix_locales: "es-DO"
    },
    {
      locales: ["en-GT"],
      fix_locales: "es-GT"
    },
    {
      locales: ["en-HN"],
      fix_locales: "es-HN"
    },
    {
      locales: ["de-MA"],
      fix_locales: "ar-MA"
    },
    {
      locales: ["en-NZ"],
      fix_locales: "ezs-NZ"
    },
    {
      locales: ["en-PE"],
      fix_locales: "es-PE"
    },
    {
      locales: ["fr-PL"],
      fix_locales: "pl-PL"
    },
    {
      locales: ["en-TH"],
      fix_locales: "th-TH"
    },
    {
      locales: ["de-TR"],
      fix_locales: "tr-TR"
    },
    {
      locales: ["en-DE"],
      fix_locales: "de-DE"
    },
    {
      locales: ["en-AT"],
      fix_locales: "de-AT"
    },
    {
      locales: ["en-BE"],
      fix_locales: "nl-BE"
    },
    {
      locales: ["en-NO"],
      fix_locales: "no-NO"
    },
    {
      locales: ["en-MX", "es-MX"],
      fix_locales: "ar-MX"
    },
    {
      locales: ["zh-TW"],
      fix_locales: "en-TW"
    },
    {
      locales: ["ar-MA"],
      fix_locales: "en-MA"
    },
    {
      locales: ["en-ID"],
      fix_locales: "id-ID"
    }
  ]
};
const getLocaleHelper = (data, str) => {
  var _a;
  return (_a = data.find((item) => item.locales.includes(str))) == null ? void 0 : _a.fix_locales;
};
function transformCurrencyLocale(option) {
  const { currency, countryCurrency, countryLangs } = currencyMap;
  let tempLocales = getLocaleHelper(currency, option.iso_code);
  if (!tempLocales) {
    const str = `${option.country_abbreviation}-${option.iso_code}`;
    tempLocales = getLocaleHelper(countryCurrency, str);
  }
  if (!tempLocales) {
    const langStr = `${option.language}-${option.country_abbreviation}`;
    tempLocales = getLocaleHelper(countryLangs, langStr);
  }
  const defaultLocale = "en-US";
  return tempLocales || defaultLocale;
}
const setL10nCurrency = (isoCode) => {
  const mainStore = useMainStore();
  isoCode = isoCode || mainStore.getCurrentCountry.iso_code;
  const currency = mainStore.getCurrencyMap[isoCode];
  const currentCountry = mainStore.getCurrentCountry;
  const langCode = mainStore.language;
  activeL10n.currency.isoCode = currency.iso_code;
  activeL10n.currency.locales = transformCurrencyLocale({
    iso_code: isoCode,
    language: langCode,
    country_abbreviation: currentCountry == null ? void 0 : currentCountry.country_abbreviation
  });
  activeL10n.currency.stuExchangeRate = currency.self_to_usd_exchange_rate;
  activeL10n.currency.utsExchangeRate = currency.usd_to_self_exchange_rate;
};
let activeL10n = {
  currency: {
    isoCode: "USD",
    locales: "en-US",
    stuExchangeRate: 1,
    utsExchangeRate: 1
  },
  _computeTypeEnum: {
    DEFAULT: "default",
    // 默认ICU标准全数据格式
    ROUNDING: "rounding",
    // 保留两位小数，四舍五入
    CARRY: "carry",
    // 保留两位小数，后面有值就进位
    TRUNCATION: "truncation",
    // 保留两位小数，直接舍去后面的小数
    INT: "int",
    // 保留整数，四舍五入
    INT_CARRY: "int_carry",
    // 整数进位
    INT_FIXED: "int_fixed",
    // 先四舍五入保留两位小数，后向上取整
    INT_TRUNCATION: "int_truncation",
    // 整数舍去小数
    INT_RT: "int_rt",
    // 先保留两位小数四舍五入，再取整数舍去小数，避免小数临界四舍五入只正好进位到整数
    ORIGINAL: "original"
    // 保留原始计算结果
  },
  uts: (usdAmount) => "",
  stu: (selfAmount) => "",
  tUts: (usdText) => "",
  setL10nCurrency
};
const currencyMantissa = {
  int: ["MYR", "THB", "PHP", "HKD", "JPY", "KRW", "INR", "PKP", "CLP", "SGD", "MVR", "TWD", "IDR"]
};
function findMantissaHelper(isoCode) {
  return Object.keys(currencyMantissa).find((mantissaType) => currencyMantissa[mantissaType].includes(isoCode));
}
const _formatL10n = (amount, type) => {
  let computeType = type ?? findMantissaHelper(activeL10n.currency.isoCode);
  if (activeL10n.currency.isoCode === "PKR" && type !== activeL10n._computeTypeEnum.ORIGINAL) {
    computeType = activeL10n._computeTypeEnum.INT;
  }
  const notRoundingType = [
    activeL10n._computeTypeEnum.ORIGINAL,
    activeL10n._computeTypeEnum.INT,
    activeL10n._computeTypeEnum.INT_CARRY,
    activeL10n._computeTypeEnum.INT_TRUNCATION,
    activeL10n._computeTypeEnum.INT_RT,
    activeL10n._computeTypeEnum.INT_FIXED
  ];
  if (["KWD", "OMR", "BHD", "TND", "JOD", "LYD"].includes(activeL10n.currency.isoCode) && !notRoundingType.includes(computeType)) {
    computeType = activeL10n._computeTypeEnum.ROUNDING;
  }
  let computeResult;
  switch (computeType) {
    case activeL10n._computeTypeEnum.DEFAULT:
      computeResult = amount;
      break;
    case activeL10n._computeTypeEnum.ROUNDING:
      amount = new Big(amount);
      computeResult = amount.toFixed(2);
      break;
    case activeL10n._computeTypeEnum.CARRY:
      amount = new Big(amount);
      amount = amount.times(100);
      computeResult = Math.ceil(amount) / 100;
      break;
    case activeL10n._computeTypeEnum.TRUNCATION:
      amount = new Big(amount);
      amount = amount.times(100);
      computeResult = Math.floor(amount) / 100;
      break;
    case activeL10n._computeTypeEnum.INT:
      computeResult = amount.toFixed();
      break;
    case activeL10n._computeTypeEnum.INT_CARRY:
      computeResult = Math.ceil(amount);
      break;
    case activeL10n._computeTypeEnum.INT_TRUNCATION:
      computeResult = Math.floor(amount);
      break;
    case activeL10n._computeTypeEnum.INT_FIXED:
      amount = new Big(amount);
      computeResult = amount.toFixed(2);
      computeResult = Math.ceil(computeResult);
      break;
    case activeL10n._computeTypeEnum.INT_RT:
      amount = new Big(amount);
      computeResult = amount.toFixed(2);
      computeResult = Math.floor(computeResult);
      break;
    case activeL10n._computeTypeEnum.ORIGINAL:
      computeResult = amount;
      break;
    default:
      computeResult = amount;
      break;
  }
  let formatResult = computeResult;
  if (computeType != activeL10n._computeTypeEnum.ORIGINAL) {
    const options = {
      style: "currency",
      currency: activeL10n.currency.isoCode
    };
    const intTypeArr = [
      activeL10n._computeTypeEnum.INT,
      activeL10n._computeTypeEnum.INT_CARRY,
      activeL10n._computeTypeEnum.INT_TRUNCATION,
      activeL10n._computeTypeEnum.INT_RT,
      activeL10n._computeTypeEnum.INT_FIXED
    ];
    const decimalsTypeArr = [activeL10n._computeTypeEnum.ROUNDING, activeL10n._computeTypeEnum.CARRY, activeL10n._computeTypeEnum.TRUNCATION];
    if (intTypeArr.includes(computeType)) {
      options.minimumFractionDigits = 0;
      options.maximumFractionDigits = 0;
    } else if (decimalsTypeArr.includes(computeType)) {
      options.minimumFractionDigits = 2;
    }
    const newLocales = `${activeL10n.currency.locales}-u-nu-latn`;
    formatResult = new Intl.NumberFormat(newLocales, options).format(computeResult);
  }
  formatResult = formatResult.toString();
  formatResult = formatResult.replace(/kr.|Nkr/, "kr");
  formatResult = formatResult.replace("SGD", "S$");
  formatResult = formatResult.replace("TRY", "TL");
  formatResult = formatResult.replace("MAD", "DH");
  formatResult = formatResult.replace("CA$", "CAD $");
  return formatResult;
};
const setUp = () => {
  if (!isReactive(activeL10n)) {
    activeL10n = reactive(activeL10n);
    const uts = computed(() => {
      return (usdAmount, type) => {
        const usdAmountTmp = usdAmount ? new Big(usdAmount) : usdAmount;
        const usdToSelfExchangeRate = new Big(activeL10n.currency.utsExchangeRate);
        let selfAmount;
        if (usdAmount) {
          selfAmount = usdAmountTmp.times(usdToSelfExchangeRate);
        } else {
          selfAmount = usdAmountTmp * usdToSelfExchangeRate;
        }
        return _formatL10n(selfAmount, type);
      };
    });
    const stu = computed(() => {
      return (usdAmount, type) => {
        return _formatL10n(usdAmount * activeL10n.currency.stuExchangeRate, type);
      };
    });
    const tUts = computed(() => {
      return (usdText, type) => {
        let selfText = usdText;
        if (typeof usdText === "string" && usdText !== "") {
          if (usdText.includes("$")) {
            const reg = /(\$\d*(\.\d*|\d*))/g;
            const replaceTxt = usdText.replace(reg, function(value) {
              const usdAmount = Number(value.slice(1));
              const selfAmount = usdAmount * activeL10n.currency.utsExchangeRate;
              return _formatL10n(selfAmount, type);
            });
            selfText = replaceTxt;
          }
        }
        return selfText;
      };
    });
    Object.assign(activeL10n, {
      uts,
      stu,
      tUts
    });
  }
};
function useL10n() {
  const scope = effectScope();
  scope.run(setUp);
  return activeL10n;
}
const style$1 = "";
function IconWrapper(render2) {
  return defineComponent({
    props: {
      width: {
        type: Number,
        required: false
      },
      height: {
        type: Number,
        required: false
      },
      fill: {
        type: String,
        required: false
      },
      color: {
        type: String,
        required: false
      },
      role: {
        type: String,
        default: "presentation"
      }
    },
    setup(props, ctx) {
      const width = props.width ?? props.height;
      const height = props.height ?? props.width;
      const fill = props.fill ?? props.color;
      return () => render2({ ...props, width, height, fill });
    }
  });
}
const ArrowLeftIcon = IconWrapper((props) => createVNode("svg", mergeProps(props, {
  "class": {
    "svg-color-fill": Boolean(props.fill)
  },
  "style": {
    "--fill-color": props.fill
  },
  "xmlns": "http://www.w3.org/2000/svg",
  "fill": "none",
  "viewBox": "0 0 28 28"
}), [createVNode("path", {
  "fill": "#444",
  "d": "M16.436 6.363a.9.9 0 0 1 1.354 1.18l-.081.093-6.434 6.435 6.434 6.434a.9.9 0 0 1 .08 1.181l-.08.092a.9.9 0 0 1-1.18.08l-.093-.08-7.07-7.07a.9.9 0 0 1-.081-1.182l.08-.092 7.071-7.07Z",
  "data-follow-fill": "#444"
}, null)]));
const ArrowRightIcon = IconWrapper((props) => createVNode("svg", mergeProps(props, {
  "class": {
    "svg-color-fill": Boolean(props.fill)
  },
  "style": {
    "--fill-color": props.fill
  },
  "xmlns": "http://www.w3.org/2000/svg",
  "fill": "none",
  "viewBox": "0 0 28 28"
}), [createVNode("path", {
  "fill": "#444",
  "d": "M10.638 6.363a.9.9 0 0 0-1.353 1.18l.08.093 6.435 6.435-6.435 6.434a.9.9 0 0 0-.08 1.181l.08.092a.9.9 0 0 0 1.18.08l.093-.08 7.071-7.07a.9.9 0 0 0 .08-1.182l-.08-.092-7.071-7.07Z",
  "data-follow-fill": "#444"
}, null)]));
const CloseIcon = IconWrapper((props) => createVNode("svg", mergeProps(props, {
  "class": {
    "svg-color-fill": Boolean(props.fill)
  },
  "style": {
    "--fill-color": props.fill
  },
  "xmlns": "http://www.w3.org/2000/svg",
  "fill": "none",
  "viewBox": "0 0 28 28"
}), [createVNode("path", {
  "fill": "#444",
  "d": "M19.655 8.337a.9.9 0 0 1 0 1.273l-4.384 4.383 4.384 4.385a.9.9 0 1 1-1.272 1.273l-4.385-4.385-4.383 4.385a.9.9 0 0 1-1.273-1.273l4.383-4.385L8.342 9.61a.9.9 0 0 1 1.273-1.273l4.383 4.383 4.385-4.383a.9.9 0 0 1 1.272 0Z",
  "clip-rule": "evenodd",
  "fill-rule": "evenodd",
  "data-follow-fill": "#444"
}, null)]));
const SearchIcon = IconWrapper((props) => createVNode("svg", mergeProps(props, {
  "class": {
    "svg-color-fill": Boolean(props.fill)
  },
  "style": {
    "--fill-color": props.fill
  },
  "xmlns": "http://www.w3.org/2000/svg",
  "fill": "none",
  "viewBox": "0 0 28 28"
}), [createVNode("path", {
  "fill": "#444",
  "d": "M7.656 7.657a8 8 0 0 1 11.819 10.759l2.57 2.57a.9.9 0 0 1-1.273 1.272l-2.594-2.593A8.002 8.002 0 0 1 7.656 7.657Zm10.253 1.06a6.5 6.5 0 1 0-9.193 9.193 6.5 6.5 0 0 0 9.193-9.193Z",
  "data-follow-fill": "#444"
}, null)]));
const platform = () => {
  if (window.PatPat) {
    if (typeof window.PatPat.PLATFORM === "function") {
      return window.PatPat.PLATFORM();
    } else if (typeof window.PatPat.PLATFORM === "string") {
      return window.PatPat.PLATFORM;
    }
  } else {
    return "wap";
  }
};
const onNativeFunction = (config, callback) => {
  let method = config;
  let param = config;
  if (typeof config === "string") {
    method = config;
    param = {
      method: config
    };
  } else {
    method = config.method;
  }
  if (callback) {
    window.nativeCallback = (...res) => {
      if (method === "login") {
        useNativeInfoStore().getNativeInfo();
      }
      callback(...res);
      window.nativeCallback = () => {
      };
    };
  }
  if (isIOS$1()) {
    window.webkit.messageHandlers.jsCallWithCallback.postMessage(JSON.stringify(param));
  } else if (isAndroid() && typeof window.PatPat.jsCallWithCallback === "function") {
    window.PatPat.jsCallWithCallback(JSON.stringify(param));
  }
};
function exitAppWebPage(isAnimation = false) {
  onNativeFunction({
    method: "finish",
    content: {
      isAnimation: isAnimation ? 0 : 1
    }
  });
}
const isIOS$1 = () => {
  return platform() === "ios";
};
const isAndroid = () => {
  return platform() === "android";
};
let timer = false;
const setTimeoutCb = () => {
  timer = false;
};
const navNativePage = (config, needChange = true) => {
  if (timer) {
    return;
  }
  timer = true;
  setTimeout(setTimeoutCb, 300);
  const pageInfo = {
    url: "",
    needChange,
    params: {},
    h5Url: "",
    isHiddenNavigationBar: false
  };
  let query = "";
  if (typeof config === "string") {
    switch (config) {
      case "home":
        pageInfo.url = "patpat://?action=homepage";
        pageInfo.needChange = false;
        pageInfo.h5Url = "/";
    }
  } else {
    pageInfo.isHiddenNavigationBar = config.isHiddenNavigationBar || false;
    if (config.name) {
      switch (config.name) {
        case "home":
          query = config.params ? `&${qs.stringify(config.params)}` : "";
          pageInfo.params = config.params || {};
          pageInfo.url = "patpat://?action=homepage" + query;
          pageInfo.needChange = false;
          pageInfo.h5Url = "/";
      }
    } else {
      pageInfo.url = config.url || "";
      pageInfo.params = config.params || {};
    }
  }
  const nativeUrl = pageInfo.needChange ? generateNativeUrl(pageInfo.url, pageInfo.params || {}, pageInfo.isHiddenNavigationBar) : pageInfo.url;
  if (isIOS$1()) {
    if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.jsCallback) {
      window.webkit.messageHandlers.jsCallback.postMessage(nativeUrl);
    } else {
      alert("App embedded browser is abnormal!");
    }
  } else if (isAndroid()) {
    if (typeof window.PatPat.jsCallback === "function") {
      window.PatPat.jsCallback(nativeUrl);
    }
  } else {
    window.location.href = pageInfo.h5Url || nativeUrl;
  }
};
const generateNativeUrl = (originUrl, params, isHiddenNavigationBar) => {
  let pageName = "webpage";
  let pageQuery = `&url=${originUrl}`;
  const urlName = getQueryString("url_name", originUrl);
  if (/\/product\//.test(originUrl)) {
    pageName = "product_detail";
    const matchUrl = originUrl.match(/[0-9]{1,11}.html/);
    const productId = matchUrl[0].split(".")[0];
    pageQuery = `&product_id=${productId}`;
  } else if (/\/category\//.test(originUrl)) {
    pageName = "category_detail";
    const matchUrl = originUrl.match(/id=[0-9]{1,11}/);
    const categoryId = matchUrl[0].split("=")[1];
    pageQuery = `&category_id=${categoryId}`;
  } else if (/\/layout\/activities\//.test(originUrl)) {
    pageName = "custom_activity";
    const matchUrl = originUrl.match(/id=[0-9]{1,11}/);
    const activityId = matchUrl[0].split("=")[1];
    pageQuery = `&activity_id=${activityId}&url_name=${urlName}`;
  } else if (/\/Daily-Special\//.test(originUrl)) {
    pageName = "event_detail";
    const matchUrl = originUrl.match(/event_id=[0-9]{1,11}/);
    const eventId = matchUrl[0].split("=")[1];
    pageQuery = `&event_id=${eventId}`;
  } else if (/\/flash-sale/.test(originUrl)) {
    pageName = "flash_sale";
    const matchUrl = originUrl.match(/event_id=[0-9]{1,11}/);
    const eventId = matchUrl[0].split("=")[1];
    pageQuery = `&event_id=${eventId}&url_name=${urlName}`;
  } else if (/\/custom_activity/.test(originUrl)) {
    pageName = "custom_activity";
  } else if (/\/account\/orders$/.test(originUrl)) {
    pageName = "order_list";
    pageQuery = "&type=1";
  } else if (/\/lucky-wheel/.test(originUrl)) {
    pageName = "webpage";
    pageQuery = `&is_hidden_navigation_bar=1&url=${originUrl}`;
  } else if (pageName === "webpage" && isHiddenNavigationBar) {
    pageQuery = `&is_hidden_navigation_bar=1&url=${originUrl}`;
  }
  if (params) {
    pageQuery += `&${qs.stringify(params)}`;
  }
  return `patpat://?action=${pageName}${pageQuery}`;
};
const __default__$b = defineComponent({
  name: "HelpCenterHeader",
  components: { SearchIcon },
  inheritAttrs: false
});
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  ...__default__$b,
  __ssrInlineRender: true,
  props: {
    title: {},
    showLeft: { type: Boolean, default: true },
    showCloseIcon: { type: Boolean, default: false },
    showRight: { type: Boolean, default: false },
    sticky: {},
    onLeftClick: {},
    statebarHeight: { default: 0 },
    leftBtnEventName: {},
    rightBtnEventName: {}
  },
  emits: ["leftClick", "rightClick"],
  setup(__props, { emit: emits }) {
    const props = __props;
    const i18n2 = useI18n();
    useRouter();
    const isARLang = computed(() => ["ar", "he"].includes(i18n2.locale.value));
    const nativeInfoStore = useNativeInfoStore();
    const inAppSafeTop = computed(() => {
      const style2 = {};
      if (nativeInfoStore.isFromApp) {
        const stateBarHeight = nativeInfoStore.iphoneStatebarHeight;
        Object.assign(style2, {
          height: `calc(56px + ${stateBarHeight}px)`,
          paddingTop: `${stateBarHeight}px`,
          marginTop: `-${stateBarHeight}px`
        });
        if (nativeInfoStore.isAndroid) {
          Object.assign(style2, { marginTop: 0 });
        }
        if (nativeInfoStore.isIos) {
          Object.assign(style2, {
            top: `${stateBarHeight}px`
          });
        }
      }
      return style2;
    });
    return (_ctx, _push, _parent, _attrs) => {
      const _directive_track = resolveDirective("track");
      _push(`<!--[--><div class="hc-header" style="${ssrRenderStyle(inAppSafeTop.value)}" data-v-1dc84080>`);
      if (props.showLeft) {
        _push(`<button${ssrRenderAttrs(mergeProps({ class: "back-btn-left" }, ssrGetDirectiveProps(_ctx, _directive_track, { pId: props.leftBtnEventName, eventName: props.leftBtnEventName }, void 0, {
          click: true,
          exposure: true
        })))} data-v-1dc84080>`);
        if (props.showCloseIcon) {
          _push(ssrRenderComponent(unref(CloseIcon), { width: 32 }, null, _parent));
        } else {
          ssrRenderVNode(_push, createVNode(resolveDynamicComponent(isARLang.value ? unref(ArrowRightIcon) : unref(ArrowLeftIcon)), { width: 32 }, null), _parent);
        }
        _push(`</button>`);
      } else {
        _push(`<!---->`);
      }
      _push(`<span class="${ssrRenderClass([{ "right-padding": !props.showRight, "left-padding": !props.showLeft }, "title-txt h4"])}" data-v-1dc84080>${ssrInterpolate(props.title)}</span>`);
      if (props.showRight) {
        _push(`<button${ssrRenderAttrs(mergeProps({ class: "back-btn-right" }, ssrGetDirectiveProps(_ctx, _directive_track, { pId: props.rightBtnEventName, eventName: props.rightBtnEventName }, void 0, {
          click: true,
          exposure: true
        })))} data-v-1dc84080>`);
        _push(ssrRenderComponent(unref(SearchIcon), { width: 32 }, null, _parent));
        _push(`</button>`);
      } else {
        _push(`<!---->`);
      }
      _push(`</div><div class="real-header" data-v-1dc84080></div><!--]-->`);
    };
  }
});
const HelpCenterHeader_vue_vue_type_style_index_0_scoped_1dc84080_lang = "";
const _export_sfc = (sfc, props) => {
  const target = sfc.__vccOpts || sfc;
  for (const [key, val] of props) {
    target[key] = val;
  }
  return target;
};
const _sfc_setup$6 = _sfc_main$6.setup;
_sfc_main$6.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/views/helpCenter/components/HelpCenterHeader.vue");
  return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
};
const HelpCenterHeader = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-1dc84080"]]);
const getHelpCenterListApi = (params) => {
  return api$1.get({
    url: "/v2/hc_v2_1/help_center",
    params
  });
};
const getHelpCenterDetailApi = (params) => {
  return api$1.get({
    url: "/v2/hc_v2_1/help_center/title",
    params
  });
};
const getContactUsListApi = (params) => {
  return api$1.get({
    url: "/v2/hc_v2_1/help_center/contact_us",
    params
  });
};
const postSubmitTicketApi = (data) => {
  return api$1.post({
    url: "/v2/hc_v2_1/help_center/contact",
    data
  });
};
const getHelpCenterResultListApi = (params) => {
  return api$1.get({
    url: "/v2/hc_v2_1/help_center/search",
    params
  });
};
const getUserOrderListApi = (params) => {
  return api$1.get({
    url: "/v2/users/order/all",
    params
  });
};
const getTicketRecordsListApi = (params) => {
  return api$1.get({
    url: "/v2/users/case/list",
    params
  });
};
const replyCaseApi = (params) => {
  return api$1.post({
    url: "/v2/users/case/reply",
    params
  });
};
const getCaseReplyDetailsApi = (params) => {
  return api$1.get({
    url: "/v2/users/case/reply_detail",
    params
  });
};
const postSolvedCaseApi = (params) => {
  return api$1.post({
    url: "/v2/users/case/finish",
    params
  });
};
const getCustomerServiceInfo = (params) => {
  return api$1.get({
    url: "/v2/common/customer_service_info",
    params
  });
};
const getCountryShippingInfoApi = (params) => {
  return api$1.get({
    url: "/v2/common/shipping_info",
    params
  });
};
const getUnreadMsgCountApi = () => {
  return api$1.get({
    url: "/v2/users/case/reply_count"
  });
};
const setSessionStorage = (name2, content) => {
  if (!name2)
    return;
  if (typeof content !== "string") {
    content = JSON.stringify(content);
  }
  sessionStorage.setItem(name2, content);
};
const getSessionStorage = (name2) => {
  if (!name2)
    return;
  const ss = sessionStorage.getItem(name2);
  if (!ss) {
    return ss;
  }
  try {
    return JSON.parse(ss);
  } catch (error) {
    return ss;
  }
};
const getLocalStore = (name2) => {
  if (!name2)
    return;
  const ls = localStorage.getItem(name2);
  if (!ls) {
    return ls;
  }
  try {
    return JSON.parse(ls);
  } catch (error) {
    return ls;
  }
};
const rootPageReg = /^activities-|^home-|^search_result-|^product_detail-|^category-|^flashsale_list-|^dailyspecial_detail-|^click-|^click_|^show-|^show_|^exposure_|^exposure-|^flash_sale-|^dailyspecial_detail-|^cart-|^cart_|^faves-/;
const createString = (len, str) => {
  if (len <= 1) {
    return str;
  }
  return createString(len - 1, str + str);
};
const affterReg = /-\d{1,4}$/;
function handlePositionId(positionId, pageName) {
  const deep = 3;
  if (typeof positionId === "string") {
    positionId = positionId.replace(rootPageReg, "").replace(/default-/g, "");
    if (!affterReg.test(positionId)) {
      positionId += "-001";
    }
    const positionArray = positionId.split("-");
    const positionArrayLength = positionArray.length;
    if (positionArray.length > deep) {
      return positionArray.reduce((prve, next, index2) => {
        if (index2 > deep - 2 && index2 < positionArrayLength - 1) {
          return prve + "_" + next;
        }
        return prve + "-" + next;
      }, pageName);
    } else if (positionArrayLength < deep) {
      const defaultLength = deep - positionArrayLength;
      const replaceStr = createString(defaultLength, "-default");
      return pageName + "-" + positionId.replace(/(-\d{1,4})$/, replaceStr + "$1");
    } else {
      return pageName + "-" + positionId;
    }
  } else {
    console.warn("positionId 不是一个字符串: ", positionId);
    return pageName + "-unknown-default-001";
  }
}
function ssrRegisterHelper(comp, filename) {
  const setup = comp.setup;
  comp.setup = (props, ctx) => {
    const ssrContext = useSSRContext();
    (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add(filename);
    if (setup) {
      return setup(props, ctx);
    }
  };
}
const __default__$a = defineComponent({
  name: "PatLink",
  props: {
    to: {
      type: [Object, String],
      required: true
    },
    replace: {
      type: Boolean,
      default: false
    },
    activeClass: {
      type: String,
      default: "router-link-active"
    },
    ariaCurrentValue: {
      type: String,
      default: "page"
    },
    custom: {
      type: Boolean,
      default: false
    },
    exactActiveClass: {
      type: String,
      default: "router-link-exact-active"
    },
    tag: {
      type: String,
      default: "a"
    },
    pContent: {
      type: [Object, String],
      default: () => {
        return "";
      }
    },
    pId: {
      type: [String, Number],
      default: ""
    },
    isHiddenNavigationBar: {
      type: Boolean,
      default: false
    }
  },
  setup(props, {
    emit,
    attrs,
    slots
  }) {
    const router = useRouter();
    const route2 = useRoute$1();
    const {
      isFromApp
    } = storeToRefs(useNativeInfoStore());
    const {
      language
    } = useMainStore();
    const originHost = ref("");
    {
      const ctx = useSSRContext();
      if (ctx)
        originHost.value = ctx.siteInfo.originHost;
    }
    const isExternalLink = computed(() => {
      let isBlank = false;
      if (typeof props.to === "string") {
        try {
          new URL(props.to);
          isBlank = true;
        } catch (e) {
          isBlank = false;
        }
        let domain = "";
        let pathname = "";
        if (isBlank) {
          const urlObj = new URL(props.to);
          domain = urlObj.host;
          pathname = urlObj.pathname;
        }
        const resolveRouteLength = router.resolve(pathname).matched.length;
        if (originHost.value) {
          isBlank = domain.indexOf(originHost.value) >= 0 || /patpat\.(com|top|vip)/.test(domain) && resolveRouteLength > 0 ? false : isBlank;
        }
      }
      return isBlank;
    });
    const isLocal = computed(() => {
      let isLocal2 = true;
      if (isExternalLink.value) {
        isLocal2 = false;
      }
      if (isLocal2 && router.resolve(vProps.value.to).matched.length <= 0) {
        isLocal2 = false;
      }
      if (isFromApp.value) {
        isLocal2 = false;
      }
      return isLocal2;
    });
    const target = computed(() => {
      return isExternalLink.value ? "_blank" : "";
    });
    const vProps = computed(() => {
      const routerProps = {
        ...props
      };
      const pathLang = language;
      if (!routerProps.to) {
        routerProps.to = route2.fullPath;
      }
      if (typeof routerProps.to === "string" && !isExternalLink.value) {
        const reg = /(http|https):\/\/([\w.]+\/?)\S*/;
        const isBlank = reg.test(routerProps.to);
        if (isBlank) {
          const origin = new URL(routerProps.to).origin;
          routerProps.to = routerProps.to.replace(origin, "");
        }
        routerProps.to = routerProps.to.replace(/^\/[a-z]{2,2}(\/|$)/, "/");
        if (pathLang) {
          routerProps.to = `/${pathLang}${routerProps.to}`;
        }
      } else if (typeof routerProps.to !== "string") {
        const namedRaw = routerProps.to;
        const pathRaw = routerProps.to;
        if (namedRaw.name) {
          namedRaw.params = Object.assign({}, {
            lang: pathLang
          }, namedRaw.params);
        } else if (pathRaw.path) {
          console.warn("对象跳转方式，不要使用path的方式来跳转，换成路由name跳转！");
        }
      }
      return {
        ...routerProps
      };
    });
    function savePosition(e) {
      const positionId = props.pId || "";
      const pageName = route2.meta && route2.meta.trackPageName ? route2.meta.trackPageName.toLocaleLowerCase() : "others";
      if (positionId && typeof positionId === "string") {
        setSessionStorage("last_click_position", positionId);
        setSessionStorage("last_page_position_id", handlePositionId(positionId, pageName));
        const positionClickTime = Date.now();
        setSessionStorage("pct:" + positionId, positionClickTime);
      }
      const targetPositionContent = props.pContent || {};
      setSessionStorage("last_click_position_content", targetPositionContent);
    }
    const renderRouterLink = () => {
      return createVNode(resolveComponent("router-link"), mergeProps(vProps.value, attrs), {
        default: () => {
          var _a;
          return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
        }
      });
    };
    const renderExternalLink = () => {
      var _a;
      const onEvent = {
        onMousedown(e) {
          savePosition();
        },
        // 这里的onClick是必须存在的，否则在app内嵌会丢失事件
        onClick(e) {
        }
      };
      const hrefAttrs = {
        href: isFromApp.value ? "javascript:void(0);" : vProps.value.to,
        target: target.value
      };
      if (isFromApp.value) {
        onEvent["onClick"] = function onClick(e) {
          const origin = window.location.origin;
          const toResolve = router.resolve(vProps.value.to);
          const positionId = props.pId || vProps.value["position-id"];
          let positionContent = props.pContent || vProps.value["position-content"] || "{}";
          if (typeof positionContent !== "string") {
            positionContent = JSON.stringify(positionContent);
          }
          const appParams = {};
          const pageName = route2.meta && route2.meta.trackPageName ? route2.meta.trackPageName.toLocaleLowerCase() : "others";
          if (props.isHiddenNavigationBar) {
            Object.assign(appParams, {
              is_hidden_navigation_bar: 1
            });
          }
          if (positionId) {
            Object.assign(appParams, {
              position: encodeURIComponent(positionId),
              position_content: encodeURIComponent(positionContent),
              pat_page_position_id: encodeURIComponent(handlePositionId(positionId, pageName)),
              tid: encodeURIComponent(getSessionStorage("last_tid") || "")
            });
          }
          if (typeof vProps.value.to !== "string") {
            const routerParams = vProps.value.to.params;
            if (routerParams && routerParams.previewData && routerParams.previewData.color) {
              Object.assign(appParams, {
                color: routerParams.previewData.color || "",
                image_url: routerParams.previewData.image || "",
                option_value_id: routerParams.previewData.option_value_id || "",
                option_value_key: routerParams.previewData.option_value_key || ""
              });
            }
          }
          if (!props.to || props.to === route2.fullPath) {
            return false;
          }
          if (typeof props.to === "string" && props.to.match("patpat://")) {
            navNativePage({
              url: props.to,
              params: appParams
            }, false);
            return false;
          }
          let url = `${origin}${toResolve.href}`;
          if (isExternalLink.value) {
            url = `${vProps.value.to}`;
          }
          console.log("url", url);
          console.log("vProps.value.to", vProps.value.to);
          navNativePage({
            url,
            params: appParams
          });
          return void 0;
        };
      }
      ({
        props: {
          ...vProps.value
        }
      });
      const propsTmp = {
        ...onEvent,
        ...attrs,
        ...hrefAttrs,
        ...vProps.value
      };
      return h(props.tag, propsTmp, (_a = slots.default) == null ? void 0 : _a.call(slots));
    };
    const renderLink = () => {
      return isLocal.value ? renderRouterLink() : renderExternalLink();
    };
    return () => renderLink();
  }
});
const __moduleId$9 = "src/components/global/patLink/index.tsx";
ssrRegisterHelper(__default__$a, __moduleId$9);
const OrderIcon = IconWrapper((props) => createVNode("svg", mergeProps(props, {
  "class": {
    "svg-color-fill": Boolean(props.fill)
  },
  "style": {
    "--fill-color": props.fill
  },
  "xmlns": "http://www.w3.org/2000/svg",
  "fill": "none",
  "viewBox": "0 0 28 28"
}), [createVNode("path", {
  "fill": "#444",
  "d": "M16 4.25a2 2 0 0 1 1.937 1.5H20a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h2.063A2 2 0 0 1 12 4.25h4Zm-5.732 3.001L8 7.25a.5.5 0 0 0-.492.41l-.008.09v14a.5.5 0 0 0 .41.492l.09.008h12a.5.5 0 0 0 .492-.41l.008-.09v-14a.5.5 0 0 0-.41-.492L20 7.25l-2.268.001A2 2 0 0 1 16 8.25h-4a2 2 0 0 1-1.732-.999Zm3.982 8.999a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1 0-1.5h3.5Zm3-4a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1 0-1.5h6.5ZM16 5.75h-4a.5.5 0 0 0-.09.992l.09.008h4a.5.5 0 0 0 .09-.992L16 5.75Z",
  "data-follow-fill": "#444"
}, null)]));
const routePrefix = "/v2_customer_service";
const helpCenterRoute = {
  path: routePrefix + "/article/help",
  name: "HelpCenter",
  component: () => import("./assets/HelpCenter-db7d20ba.js"),
  meta: {
    trackPageName: "customer_service"
  }
};
const helpCenterDetailRoute = {
  path: routePrefix + "/article/help/helpmain/:detailTitle/:detailsId",
  name: "HelpCenterDetail",
  component: () => import("./assets/HelpCenterDetail-ced962f5.js"),
  meta: {
    trackPageName: "customer_service_detail"
  }
};
const submitTicketRoute = {
  path: routePrefix + "/article/help/submit-ticket",
  name: "SubmitTicket",
  component: () => import("./assets/SubmitTicket-de0ff478.js"),
  meta: {
    trackPageName: "submit_ticket"
  }
};
const replyTicketRoute = {
  path: routePrefix + "/article/help/reply-ticket/:caseId(\\d+)",
  name: "ReplyTicket",
  component: () => import("./assets/SubmitTicket-de0ff478.js"),
  meta: {
    trackPageName: "reply_ticket"
  }
};
const submitCompleteRoute = {
  path: routePrefix + "/article/help/submit-complete",
  name: "SubmitComplete",
  component: () => import("./assets/SubmitComplete-95c5eb60.js"),
  meta: {
    trackPageName: "submit_complete"
  }
};
const helpSearchResultRoute = {
  path: routePrefix + "/article/help/result",
  name: "HelpSearchResult",
  component: () => import("./assets/HelpSearchResult-70a6cb76.js"),
  meta: {
    trackPageName: "customer_service_search"
  }
};
const ticketRecordsRoute = {
  path: routePrefix + "/service-message",
  name: "TicketRecords",
  component: () => Promise.resolve().then(() => TicketRecords),
  meta: {
    trackPageName: "ticket_record"
  }
};
const ticketDetailRoute = {
  path: routePrefix + "/service-detail",
  name: "TicketDetail",
  component: () => import("./assets/TicketDetail-b03bd8da.js"),
  meta: {
    trackPageName: "ticket_detail"
  }
};
const helpCenterRoutes = [
  helpCenterRoute,
  helpCenterDetailRoute,
  submitTicketRoute,
  replyTicketRoute,
  submitCompleteRoute,
  helpSearchResultRoute,
  ticketRecordsRoute,
  ticketDetailRoute
];
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  __name: "TicketListItem",
  __ssrInlineRender: true,
  props: {
    ticketItem: {}
  },
  emits: ["clearDot"],
  setup(__props, { emit: emits }) {
    const props = __props;
    const { t } = useI18n();
    const replyInfo = computed(() => {
      return props.ticketItem.case_reply_vo_latest || {};
    });
    const isCloseStauts = computed(() => {
      return [4, 5].includes(props.ticketItem.status);
    });
    const dotStyle = computed(() => {
      if (replyInfo.value.msg_read === 0) {
        return { backgroundColor: "var(--pat-brand-red)" };
      } else {
        return { backgroundColor: "transparent" };
      }
    });
    function getReplyContent() {
      if (replyInfo.value.is_first === 1) {
        return "";
      } else {
        if (replyInfo.value.content) {
          const text = replyInfo.value.content.replace(/<(?:.|\s)*?>/g, "");
          const imgTagReg = /<img.*?(?:>|\/>)/gi;
          const hasImgTag = imgTagReg.test(replyInfo.value.content);
          return `${hasImgTag ? '<span class="include-pic content2">[Include Pic]</span>' : ""}<p class="ellipsis content2">${text}</p>`;
        } else {
          return "";
        }
      }
    }
    return (_ctx, _push, _parent, _attrs) => {
      _push(ssrRenderComponent(unref(__default__$a), mergeProps({
        to: { name: unref(ticketDetailRoute).name, query: { case_id: replyInfo.value.case_id } }
      }, _attrs), {
        default: withCtx((_2, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`<div class="ticket-item" data-v-48a309f6${_scopeId}><div class="item-title" data-v-48a309f6${_scopeId}>`);
            _push2(ssrRenderComponent(unref(OrderIcon), {
              width: 24,
              height: 24
            }, null, _parent2, _scopeId));
            _push2(`<p class="${ssrRenderClass([[replyInfo.value.is_first === 1 ? "multi-ellipsis--l2" : "ellipsis"], "content2-bold"])}" data-v-48a309f6${_scopeId}>${ssrInterpolate(props.ticketItem.title)}</p></div>`);
            if (replyInfo.value.is_first !== 1) {
              _push2(`<div class="reply-content" data-v-48a309f6${_scopeId}><span style="${ssrRenderStyle(dotStyle.value)}" class="red-dot" data-v-48a309f6${_scopeId}></span><span class="msg-txt content2 ellipsis" data-v-48a309f6${_scopeId}>${getReplyContent()}</span></div>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`<div class="reply-info" data-v-48a309f6${_scopeId}><span class="create-time content3" data-v-48a309f6${_scopeId}>${ssrInterpolate(unref(transformUTCToLocal)(replyInfo.value.created_at))}</span><span class="content3" data-v-48a309f6${_scopeId}>${ssrInterpolate(isCloseStauts.value ? unref(t)("account.help.Ended") : unref(t)("account.help.In_Progress"))}</span></div></div>`);
          } else {
            return [
              createVNode("div", {
                class: "ticket-item",
                onClick: ($event) => emits("clearDot"),
                onKeydown: withKeys(($event) => emits("clearDot"), ["enter"])
              }, [
                createVNode("div", { class: "item-title" }, [
                  createVNode(unref(OrderIcon), {
                    width: 24,
                    height: 24
                  }),
                  createVNode("p", {
                    class: ["content2-bold", [replyInfo.value.is_first === 1 ? "multi-ellipsis--l2" : "ellipsis"]]
                  }, toDisplayString(props.ticketItem.title), 3)
                ]),
                replyInfo.value.is_first !== 1 ? (openBlock(), createBlock("div", {
                  key: 0,
                  class: "reply-content"
                }, [
                  createVNode("span", {
                    style: dotStyle.value,
                    class: "red-dot"
                  }, null, 4),
                  createVNode("span", {
                    class: "msg-txt content2 ellipsis",
                    innerHTML: getReplyContent()
                  }, null, 8, ["innerHTML"])
                ])) : createCommentVNode("", true),
                createVNode("div", { class: "reply-info" }, [
                  createVNode("span", { class: "create-time content3" }, toDisplayString(unref(transformUTCToLocal)(replyInfo.value.created_at)), 1),
                  createVNode("span", { class: "content3" }, toDisplayString(isCloseStauts.value ? unref(t)("account.help.Ended") : unref(t)("account.help.In_Progress")), 1)
                ])
              ], 40, ["onClick", "onKeydown"])
            ];
          }
        }),
        _: 1
      }, _parent));
    };
  }
});
const TicketListItem_vue_vue_type_style_index_0_scoped_48a309f6_lang = "";
const _sfc_setup$5 = _sfc_main$5.setup;
_sfc_main$5.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/views/helpCenter/components/TicketListItem.vue");
  return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
};
const TicketListItem = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-48a309f6"]]);
const CircleLoadingIcon = IconWrapper((props) => createVNode("svg", mergeProps(props, {
  "class": {
    "svg-color-fill": Boolean(props.fill),
    "svg-loading-circle": true
  },
  "style": {
    "--fill-color": props.fill,
    color: props.fill
  },
  "viewBox": "25 25 50 50"
}), [createVNode("circle", {
  "cx": "50",
  "cy": "50",
  "r": "20",
  "fill": "none"
}, null)]));
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  __name: "PullRefresh",
  __ssrInlineRender: true,
  props: {
    pull: { type: Boolean, default: true },
    scrollDomId: {}
  },
  emits: ["refresh"],
  setup(__props, { emit: emits }) {
    const props = __props;
    const style2 = computed(() => {
      let style22 = {};
      if (state.isMounted && props.pull) {
        style22 = {
          transition: `${state.duration}ms`,
          transform: `translate(0,${state.moveDistance}px)`
        };
      }
      return style22;
    });
    const state = reactive({
      isMounted: false,
      startY: 0,
      // 保存touch时的Y坐标
      moveDistance: 0,
      // 保存向下滑动的距离
      moveState: 0,
      // 开始滑动到结束后状态的变化 0:下拉即可刷新 1:释放即可刷新 2:加载中
      duration: 0
      // 动画持续时间，0就是没有动画
    });
    watch(
      () => state.moveState,
      (val) => {
        if (val === 0 && state.duration === 300) {
          state.moveDistance = 0;
        }
      }
    );
    onMounted(() => {
      state.isMounted = true;
    });
    return (_ctx, _push, _parent, _attrs) => {
      _push(`<div${ssrRenderAttrs(mergeProps({
        ref: "scrollBox",
        class: "pat-pull-refresh",
        style: style2.value
      }, _attrs))} data-v-16d48b89><div class="pat-pull-refreshing-box" data-v-16d48b89>`);
      if (state.isMounted && _ctx.pull) {
        _push(`<!--[-->`);
        if (state.moveState >= 2) {
          _push(`<div data-v-16d48b89>`);
          _push(ssrRenderComponent(unref(CircleLoadingIcon), {
            width: 24,
            height: 24
          }, null, _parent));
          _push(`</div>`);
        } else {
          _push(`<!---->`);
        }
        _push(`<!--]-->`);
      } else {
        _push(`<!---->`);
      }
      _push(`</div><div class="pat-pull-present-box" data-v-16d48b89>`);
      ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
      _push(`</div></div>`);
    };
  }
});
const PullRefresh_vue_vue_type_style_index_0_scoped_16d48b89_lang = "";
const _sfc_setup$4 = _sfc_main$4.setup;
_sfc_main$4.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/PullRefresh.vue");
  return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
};
const PullRefresh = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-16d48b89"]]);
const PlusIcon = IconWrapper((props) => createVNode("svg", mergeProps(props, {
  "class": {
    "svg-color-fill": Boolean(props.fill)
  },
  "style": {
    "--fill-color": props.fill
  },
  "xmlns": "http://www.w3.org/2000/svg",
  "fill": "none",
  "viewBox": "0 0 28 28"
}), [createVNode("path", {
  "fill": "#444",
  "d": "M14 6.15a.9.9 0 0 1 .9.9l-.001 6.2H21.1a.9.9 0 1 1 0 1.8h-6.2v6.2a.9.9 0 0 1-1.8 0v-6.2H6.9a.9.9 0 0 1 0-1.8h6.199l.001-6.2a.9.9 0 0 1 .9-.9Z",
  "clip-rule": "evenodd",
  "fill-rule": "evenodd",
  "data-follow-fill": "#444"
}, null)]));
function renderComponent(config) {
  const container = config.el || document.createElement("div");
  !config.el && document.body.appendChild(container);
  let props = config.props;
  function createNode() {
    const vnode = createVNode({
      setup() {
        return () => createVNode(config.component, props, config.children);
      }
    });
    vnode.appContext = { ...config.appContext };
    return vnode;
  }
  let parentVNode = createNode();
  render$1(parentVNode, container);
  function update(newProps) {
    var _a;
    props = Object.assign({}, props, newProps);
    (_a = parentVNode == null ? void 0 : parentVNode.component) == null ? void 0 : _a.update();
  }
  function destroy() {
    render$1(null, container);
    parentVNode = null;
    setTimeout(() => {
      if (!config.el) {
        document.body.removeChild(container);
      }
    });
  }
  return { destroy, update };
}
const isDef = (val) => val !== void 0 && val !== null;
const isFunction = (val) => typeof val === "function";
const isObject$1 = (val) => val !== null && typeof val === "object";
const isPromise = (val) => isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
const isIOS = () => inBrowser$2 ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
function noop$1() {
}
const extend$1 = Object.assign;
const inBrowser$2 = typeof window !== "undefined";
function pick(obj, keys, ignoreUndefined) {
  return keys.reduce((ret, key) => {
    if (!ignoreUndefined || obj[key] !== void 0) {
      ret[key] = obj[key];
    }
    return ret;
  }, {});
}
function supportWebp() {
  if (!inBrowser$2)
    return false;
  let support = true;
  try {
    const elem = document.createElement("canvas");
    if (elem.getContext && elem.getContext("2d")) {
      support = elem.toDataURL("image/webp").indexOf("data:image/webp") === 0;
    }
  } catch (err) {
    support = false;
  }
  return support;
}
const unknownProp = null;
const numericProp = [Number, String];
const truthProp = {
  type: Boolean,
  default: true
};
const makeNumberProp = (defaultVal) => ({
  type: Number,
  default: defaultVal
});
const makeNumericProp = (defaultVal) => ({
  type: numericProp,
  default: defaultVal
});
const makeStringProp = (defaultVal) => ({
  type: String,
  default: defaultVal
});
const { width: windowWidth$1, height: windowHeight$1 } = useWindowSize();
const inBrowser$1 = typeof window !== "undefined";
const extend = Object.assign;
function isHidden$1(elementRef) {
  const el = unref(elementRef);
  if (!el) {
    return false;
  }
  const style2 = window.getComputedStyle(el);
  const hidden = style2.display === "none";
  const parentHidden = el.offsetParent === null && style2.position !== "fixed";
  return hidden || parentHidden;
}
function getScrollTop(el) {
  const top = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
  return Math.max(top, 0);
}
function getZIndexStyle$1(zIndex) {
  const style2 = {};
  if (zIndex !== void 0) {
    style2.zIndex = +zIndex;
  }
  return style2;
}
let rootFontSize;
function getRootFontSize() {
  if (!rootFontSize) {
    const doc = document.documentElement;
    const fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
    rootFontSize = parseFloat(fontSize);
  }
  return rootFontSize;
}
function convertVw(value) {
  value = value.replace(/vw/g, "");
  return +value * windowWidth$1.value / 100;
}
function convertVh(value) {
  value = value.replace(/vh/g, "");
  return +value * windowHeight$1.value / 100;
}
function convertRem(value) {
  value = value.replace(/rem/g, "");
  return +value * getRootFontSize();
}
function unitToPx(value) {
  if (typeof value === "number") {
    return value;
  }
  if (inBrowser$1) {
    if (value.includes("rem")) {
      return convertRem(value);
    }
    if (value.includes("vw")) {
      return convertVw(value);
    }
    if (value.includes("vh")) {
      return convertVh(value);
    }
  }
  return parseFloat(value);
}
function raf(fn) {
  return inBrowser$1 ? requestAnimationFrame(fn) : -1;
}
function doubleRaf(fn) {
  raf(() => raf(fn));
}
const isWindow = (val) => val === window;
const makeDOMRect = (width, height) => ({
  top: 0,
  left: 0,
  right: width,
  bottom: height,
  width,
  height
});
const useRect = (elementOrRef) => {
  const element = unref(elementOrRef);
  if (isWindow(element)) {
    const width = element.innerWidth;
    const height = element.innerHeight;
    return makeDOMRect(width, height);
  }
  if (element == null ? void 0 : element.getBoundingClientRect) {
    return element.getBoundingClientRect();
  }
  return makeDOMRect(0, 0);
};
const overflowScrollReg = /scroll|auto|overlay/i;
const defaultRoot = inBrowser$1 ? window : void 0;
function isElement(node) {
  const ELEMENT_NODE_TYPE = 1;
  return node.tagName !== "HTML" && node.tagName !== "BODY" && node.nodeType === ELEMENT_NODE_TYPE;
}
function getScrollParent(el, root = defaultRoot) {
  let node = el;
  while (node && node !== root && isElement(node)) {
    const { overflowY } = window.getComputedStyle(node);
    if (overflowScrollReg.test(overflowY)) {
      return node;
    }
    node = node.parentNode;
  }
  return root;
}
function useScrollParent(el, root = defaultRoot) {
  const scrollParent2 = ref();
  onMounted(() => {
    if (el.value) {
      scrollParent2.value = getScrollParent(el.value, root);
    }
  });
  return scrollParent2;
}
function onMountedOrActivated(hook) {
  let mounted;
  onMounted(() => {
    hook();
    nextTick(() => {
      mounted = true;
    });
  });
  onActivated(() => {
    if (mounted) {
      hook();
    }
  });
}
function useEventListener(type, listener, options = {}) {
  if (!inBrowser$1) {
    return;
  }
  const { target = window, passive = false, capture = false } = options;
  let attached;
  const add = (target2) => {
    const element = unref(target2);
    if (element && !attached) {
      element.addEventListener(type, listener, {
        capture,
        passive
      });
      attached = true;
    }
  };
  const remove2 = (target2) => {
    const element = unref(target2);
    if (element && attached) {
      element.removeEventListener(type, listener, capture);
      attached = false;
    }
  };
  onUnmounted(() => remove2(target));
  onDeactivated(() => remove2(target));
  onMountedOrActivated(() => add(target));
  if (isRef(target)) {
    watch(target, (val, oldVal) => {
      remove2(oldVal);
      add(val);
    });
  }
}
function useExpose(apis) {
  const instance = getCurrentInstance();
  if (instance) {
    extend(instance.proxy, apis);
  }
}
function getDirection(x, y) {
  if (x > y) {
    return "horizontal";
  }
  if (y > x) {
    return "vertical";
  }
  return "";
}
function useTouch() {
  const startX = ref(0);
  const startY = ref(0);
  const deltaX = ref(0);
  const deltaY = ref(0);
  const offsetX = ref(0);
  const offsetY = ref(0);
  const direction = ref("");
  const isVertical = () => direction.value === "vertical";
  const isHorizontal = () => direction.value === "horizontal";
  const reset = () => {
    deltaX.value = 0;
    deltaY.value = 0;
    offsetX.value = 0;
    offsetY.value = 0;
    direction.value = "";
  };
  const start = (event) => {
    reset();
    startX.value = event.touches[0].clientX;
    startY.value = event.touches[0].clientY;
  };
  const move = (event) => {
    const touch = event.touches[0];
    deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
    deltaY.value = touch.clientY - startY.value;
    offsetX.value = Math.abs(deltaX.value);
    offsetY.value = Math.abs(deltaY.value);
    const LOCK_DIRECTION_DISTANCE = 10;
    if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
      direction.value = getDirection(offsetX.value, offsetY.value);
    }
  };
  return {
    move,
    start,
    reset,
    startX,
    startY,
    deltaX,
    deltaY,
    offsetX,
    offsetY,
    direction,
    isVertical,
    isHorizontal
  };
}
let totalLockCount = 0;
const BODY_LOCK_CLASS = "pat-overflow-hidden";
function useLockScroll(rootRef, shouldLock) {
  const touch = useTouch();
  const DIRECTION_UP = "01";
  const DIRECTION_DOWN = "10";
  const onTouchMove = (event) => {
    touch.move(event);
    const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
    const el = getScrollParent(event.target, rootRef.value);
    const { scrollHeight, offsetHeight, scrollTop } = el;
    let status = "11";
    if (scrollTop === 0) {
      status = offsetHeight >= scrollHeight ? "00" : "01";
    } else if (scrollTop + offsetHeight >= scrollHeight) {
      status = "10";
    }
    if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
      preventDefault(event, true);
    }
  };
  const lock = () => {
    document.addEventListener("touchstart", touch.start);
    document.addEventListener("touchmove", onTouchMove, { passive: false });
    if (!totalLockCount) {
      document.body.classList.add(BODY_LOCK_CLASS);
    }
    totalLockCount++;
  };
  const unlock = () => {
    if (totalLockCount) {
      document.removeEventListener("touchstart", touch.start);
      document.removeEventListener("touchmove", onTouchMove);
      totalLockCount--;
      if (!totalLockCount) {
        document.body.classList.remove(BODY_LOCK_CLASS);
      }
    }
  };
  const init = () => shouldLock() && lock();
  const destroy = () => shouldLock() && unlock();
  onMountedOrActivated(init);
  onDeactivated(destroy);
  onBeforeUnmount(destroy);
  watch(shouldLock, (value) => {
    value ? lock() : unlock();
  });
}
let globalZIndex = 2e3;
const useGlobalZIndex = () => ++globalZIndex;
function useLazyRender(show) {
  const inited = ref(false);
  watch(
    show,
    (value) => {
      if (value) {
        inited.value = value;
      }
    },
    { immediate: true }
  );
  return (render2) => () => inited.value ? render2() : null;
}
const POPUP_TOGGLE_KEY = Symbol();
function onPopupReopen(callback) {
  const popupToggleStatus = inject(POPUP_TOGGLE_KEY, null);
  if (popupToggleStatus) {
    watch(popupToggleStatus, (show) => {
      if (show) {
        callback();
      }
    });
  }
}
const routeProps = {
  to: [String, Object],
  url: String,
  replace: Boolean
};
function route({ to, url, replace, $router: router }) {
  if (to && router) {
    router[replace ? "replace" : "push"](to);
  } else if (url) {
    replace ? location.replace(url) : location.href = url;
  }
}
function useRoute() {
  const vm = getCurrentInstance().proxy;
  return () => route(vm);
}
function useParent(key) {
  const parent = inject(key, null);
  if (parent) {
    const instance = getCurrentInstance();
    const { link, unlink, internalChildren } = parent;
    link(instance);
    onUnmounted(() => unlink(instance));
    const index2 = computed(() => internalChildren.indexOf(instance));
    return {
      parent,
      index: index2
    };
  }
  return {
    parent: null,
    index: ref(-1)
  };
}
function flattenVNodes(children) {
  const result = [];
  const traverse = (children2) => {
    if (Array.isArray(children2)) {
      children2.forEach((child) => {
        var _a;
        if (isVNode(child)) {
          result.push(child);
          if ((_a = child.component) == null ? void 0 : _a.subTree) {
            result.push(child.component.subTree);
            traverse(child.component.subTree.children);
          }
          if (child.children) {
            traverse(child.children);
          }
        }
      });
    }
  };
  traverse(children);
  return result;
}
function sortChildren(parent, publicChildren, internalChildren) {
  const vnodes = flattenVNodes(parent.subTree.children);
  internalChildren.sort((a, b) => vnodes.indexOf(a.vnode) - vnodes.indexOf(b.vnode));
  const orderedPublicChildren = internalChildren.map((item) => item.proxy);
  publicChildren.sort((a, b) => {
    const indexA = orderedPublicChildren.indexOf(a);
    const indexB = orderedPublicChildren.indexOf(b);
    return indexA - indexB;
  });
}
function useChildren(key) {
  const publicChildren = reactive([]);
  const internalChildren = reactive([]);
  const parent = getCurrentInstance();
  const linkChildren = (value) => {
    const link = (child) => {
      if (child.proxy) {
        internalChildren.push(child);
        publicChildren.push(child.proxy);
        sortChildren(parent, publicChildren, internalChildren);
      }
    };
    const unlink = (child) => {
      const index2 = internalChildren.indexOf(child);
      publicChildren.splice(index2, 1);
      internalChildren.splice(index2, 1);
    };
    provide(
      key,
      Object.assign(
        {
          link,
          unlink,
          children: publicChildren,
          internalChildren
        },
        value
      )
    );
  };
  return {
    children: publicChildren,
    linkChildren
  };
}
let visibility;
function usePageVisibility() {
  if (!visibility) {
    visibility = ref("visible");
    if (inBrowser$1) {
      const update = () => {
        visibility.value = document.hidden ? "hidden" : "visible";
      };
      update();
      window.addEventListener("visibilitychange", update);
    }
  }
  return visibility;
}
isIOS();
const stopPropagation = (event) => event.stopPropagation();
function preventDefault(event, isStopPropagation) {
  if (typeof event.cancelable !== "boolean" || event.cancelable) {
    event.preventDefault();
  }
  if (isStopPropagation) {
    stopPropagation(event);
  }
}
function isHidden(elementRef) {
  const el = unref(elementRef);
  if (!el) {
    return false;
  }
  const style2 = window.getComputedStyle(el);
  const hidden = style2.display === "none";
  const parentHidden = el.offsetParent === null && style2.position !== "fixed";
  return hidden || parentHidden;
}
const { width: windowWidth, height: windowHeight } = useWindowSize();
function genBem(name2, mods) {
  if (!mods) {
    return "";
  }
  if (typeof mods === "string") {
    return ` ${name2}--${mods}`;
  }
  if (Array.isArray(mods)) {
    return mods.reduce((ret, item) => ret + genBem(name2, item), "");
  }
  return Object.keys(mods).reduce((ret, key) => ret + (mods[key] ? genBem(name2, key) : ""), "");
}
function createBEM(name2) {
  return (el, mods) => {
    if (el && typeof el !== "string") {
      mods = el;
      el = "";
    }
    el = el ? `${name2}__${el}` : name2;
    return `${el}${genBem(el, mods)}`;
  };
}
function createNamespace(name2) {
  const prefixedName = `pat-${name2}`;
  return [prefixedName, createBEM(prefixedName)];
}
function addUnit(value) {
  if (isDef(value)) {
    return isNumeric(value) ? `${value}px` : String(value);
  }
  return void 0;
}
function getZIndexStyle(zIndex) {
  const style2 = {};
  if (zIndex !== void 0) {
    style2.zIndex = +zIndex;
  }
  return style2;
}
const camelizeRE = /-(\w)/g;
const camelize = (str) => str.replace(camelizeRE, (_2, c) => c.toUpperCase());
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
const BORDER = "pat-hairline";
const BORDER_TOP = `${BORDER}--top`;
const BORDER_LEFT = `${BORDER}--left`;
const BORDER_SURROUND = `${BORDER}--surround`;
function callInterceptor(interceptor, {
  args = [],
  done,
  canceled
}) {
  if (interceptor) {
    const returnVal = interceptor.apply(null, args);
    if (isPromise(returnVal)) {
      returnVal.then((value) => {
        if (value) {
          done();
        } else if (canceled) {
          canceled();
        }
      }).catch(noop$1);
    } else if (returnVal) {
      done();
    } else if (canceled) {
      canceled();
    }
  } else {
    done();
  }
}
function withInstall(options) {
  options.install = (app) => {
    const { name: name2 } = options;
    if (name2) {
      app.component(camelize(`-${name2}`), options);
    }
  };
  return options;
}
const index$6 = "";
const overlayProps = {
  show: Boolean,
  zIndex: numericProp,
  duration: numericProp,
  className: unknownProp,
  lockScroll: truthProp,
  lazyRender: truthProp,
  customStyle: Object
};
const __default__$9 = defineComponent({
  name: "PatOverlay",
  props: overlayProps,
  setup(props, {
    slots
  }) {
    const root = ref();
    const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
    const onTouchMove = (event) => {
      if (props.lockScroll) {
        preventDefault(event, true);
      }
    };
    const renderOverlay = lazyRender(() => {
      var _a;
      const style2 = extend$1(getZIndexStyle(props.zIndex), props.customStyle);
      if (isDef(props.duration)) {
        style2.animationDuration = `${props.duration}s`;
      }
      return withDirectives(createVNode("div", {
        "ref": root,
        "style": style2,
        "class": ["pat-overlay", props.className]
      }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vShow, props.show]]);
    });
    useEventListener("touchmove", onTouchMove, {
      target: root
    });
    return () => createVNode(Transition, {
      "name": "pat-fade",
      "appear": true
    }, {
      default: renderOverlay
    });
  }
});
const __moduleId$8 = "src/components/global/overlay/overlay.tsx";
ssrRegisterHelper(__default__$9, __moduleId$8);
const Overlay = withInstall(__default__$9);
const WarnIcon = IconWrapper((props) => createVNode("svg", mergeProps(props, {
  "class": {
    "svg-color-fill": Boolean(props.fill)
  },
  "style": {
    "--fill-color": props.fill
  },
  "xmlns": "http://www.w3.org/2000/svg",
  "fill": "none",
  "viewBox": "0 0 28 28"
}), [createVNode("path", {
  "fill": "#444",
  "d": "M14 4.5a9.5 9.5 0 1 1 0 19 9.5 9.5 0 0 1 0-19ZM14 6a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm0 11.25a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm0-8.75a.75.75 0 0 1 .743.648l.007.102v6.02a.75.75 0 0 1-1.493.101l-.007-.102V9.25A.75.75 0 0 1 14 8.5Z",
  "data-follow-fill": "#444"
}, null)]));
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  __name: "Index",
  __ssrInlineRender: true,
  props: {
    showIcon: { type: Boolean, default: true },
    content: {},
    showCancelButton: { type: Boolean, default: true },
    showOkButton: { type: Boolean, default: true },
    cancelText: { default: "cancel" },
    cancelProps: {},
    okProps: {},
    okText: { default: "ok" },
    maskClosable: { type: Boolean, default: false },
    conentStyle: {},
    onOk: {}
  },
  emits: ["cancel"],
  setup(__props, { emit: emits }) {
    const props = __props;
    const loading = ref(false);
    function onClickMask() {
      if (props.maskClosable) {
        emits("cancel");
      }
    }
    async function onClickOk() {
      if (loading.value) {
        return;
      }
      if (typeof props.onOk === "function") {
        loading.value = true;
        const res = await props.onOk();
        loading.value = false;
        return res;
      }
    }
    function onAutoFocusBtn(vnode) {
      const el = vnode.el;
      el == null ? void 0 : el.focus();
    }
    return (_ctx, _push, _parent, _attrs) => {
      _push(ssrRenderComponent(unref(Overlay), mergeProps({
        show: "",
        onClick: onClickMask
      }, _attrs), {
        default: withCtx((_2, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`<div${ssrRenderAttrs(mergeProps({ class: "dialog-content" }, _ctx.conentStyle))} data-v-91baadd0${_scopeId}>`);
            ssrRenderSlot(_ctx.$slots, "icon", {}, () => {
              if (props.showIcon) {
                _push2(ssrRenderComponent(unref(WarnIcon), {
                  width: 80,
                  height: 80,
                  color: "#ffe3a8"
                }, null, _parent2, _scopeId));
              } else {
                _push2(`<!---->`);
              }
            }, _push2, _parent2, _scopeId);
            ssrRenderSlot(_ctx.$slots, "content", {}, () => {
              _push2(`<span class="content2" data-v-91baadd0${_scopeId}>${ssrInterpolate(props.content)}</span>`);
            }, _push2, _parent2, _scopeId);
            ssrRenderSlot(_ctx.$slots, "button", {}, () => {
              _push2(`<div class="btns content2" data-v-91baadd0${_scopeId}>`);
              if (props.showCancelButton) {
                _push2(`<button${ssrRenderAttrs(mergeProps({ class: "cancel-btn" }, props.cancelProps))} data-v-91baadd0${_scopeId}>${ssrInterpolate(props.cancelText)}</button>`);
              } else {
                _push2(`<!---->`);
              }
              if (props.showOkButton) {
                _push2(`<button${ssrRenderAttrs(mergeProps({ class: "ok-btn" }, props.okProps))} data-v-91baadd0${_scopeId}>`);
                if (loading.value) {
                  _push2(ssrRenderComponent(unref(CircleLoadingIcon), {
                    width: 16,
                    height: 16
                  }, null, _parent2, _scopeId));
                } else {
                  _push2(`<span data-v-91baadd0${_scopeId}>${ssrInterpolate(props.okText)}</span>`);
                }
                _push2(`</button>`);
              } else {
                _push2(`<!---->`);
              }
              _push2(`</div>`);
            }, _push2, _parent2, _scopeId);
            _push2(`</div>`);
          } else {
            return [
              createVNode("div", mergeProps({ class: "dialog-content" }, _ctx.conentStyle, {
                onClick: withModifiers(() => {
                }, ["stop"])
              }), [
                renderSlot(_ctx.$slots, "icon", {}, () => [
                  props.showIcon ? (openBlock(), createBlock(unref(WarnIcon), {
                    key: 0,
                    width: 80,
                    height: 80,
                    color: "#ffe3a8"
                  })) : createCommentVNode("", true)
                ], true),
                renderSlot(_ctx.$slots, "content", {}, () => [
                  createVNode("span", { class: "content2" }, toDisplayString(props.content), 1)
                ], true),
                renderSlot(_ctx.$slots, "button", {}, () => [
                  createVNode("div", { class: "btns content2" }, [
                    props.showCancelButton ? (openBlock(), createBlock("button", mergeProps({
                      key: 0,
                      class: "cancel-btn"
                    }, props.cancelProps, {
                      onClick: ($event) => emits("cancel"),
                      onVnodeMounted: onAutoFocusBtn
                    }), toDisplayString(props.cancelText), 17, ["onClick"])) : createCommentVNode("", true),
                    props.showOkButton ? (openBlock(), createBlock("button", mergeProps({
                      key: 1,
                      class: "ok-btn"
                    }, props.okProps, {
                      onClick: onClickOk,
                      onVnodeMounted: onAutoFocusBtn
                    }), [
                      loading.value ? (openBlock(), createBlock(unref(CircleLoadingIcon), {
                        key: 0,
                        width: 16,
                        height: 16
                      })) : (openBlock(), createBlock("span", { key: 1 }, toDisplayString(props.okText), 1))
                    ], 16)) : createCommentVNode("", true)
                  ])
                ], true)
              ], 16, ["onClick"])
            ];
          }
        }),
        _: 3
      }, _parent));
    };
  }
});
const Index_vue_vue_type_style_index_0_scoped_91baadd0_lang = "";
const _sfc_setup$3 = _sfc_main$3.setup;
_sfc_main$3.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/MessageDialog/Index.vue");
  return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
};
const MessageDialog = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-91baadd0"]]);
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  __name: "AppLayout",
  __ssrInlineRender: true,
  props: {
    clearSafeTopArea: { type: Boolean, default: false }
  },
  emits: ["scroll"],
  setup(__props, { emit: emits }) {
    const props = __props;
    const scrollTop = ref(0);
    const nativeInfoStore = useNativeInfoStore();
    const appLayoutRef = ref();
    const contentHeight = ref("100vh");
    const isFromIosApp = computed(() => {
      return nativeInfoStore.isFromApp && nativeInfoStore.isIos;
    });
    const appLayoutStyle = computed(() => {
      const style2 = { height: contentHeight.value };
      if (nativeInfoStore.isFromApp) {
        const statebarHeight = nativeInfoStore.iphoneStatebarHeight;
        Object.assign(style2, { paddingTop: `${props.clearSafeTopArea ? 0 : statebarHeight}px` });
      }
      return style2;
    });
    function onScroll(evt) {
      if (appLayoutRef.value) {
        scrollTop.value = appLayoutRef.value.scrollTop;
      }
      emits("scroll", evt);
    }
    function onResize(evt) {
      contentHeight.value = `${window.innerHeight}px`;
      onScroll(evt);
    }
    onUnmounted(() => {
      document.body.classList.remove("disable-overflow");
    });
    onMounted(() => {
      document.body.classList.add("disable-overflow");
      setTimeout(onResize);
      useEventListener$1(window, "resize", onResize);
    });
    return (_ctx, _push, _parent, _attrs) => {
      const _component_ClientOnly = resolveComponent("ClientOnly");
      _push(`<div${ssrRenderAttrs(mergeProps({
        ref_key: "appLayoutRef",
        ref: appLayoutRef,
        class: "app-layout",
        style: appLayoutStyle.value
      }, _attrs))} data-v-9c9c71f7>`);
      if (isFromIosApp.value) {
        _push(ssrRenderComponent(_component_ClientOnly, null, {
          default: withCtx((_2, _push2, _parent2, _scopeId) => {
            if (_push2) {
              ssrRenderSlot(_ctx.$slots, "default", { scrollTop: scrollTop.value }, null, _push2, _parent2, _scopeId);
            } else {
              return [
                renderSlot(_ctx.$slots, "default", { scrollTop: scrollTop.value }, void 0, true)
              ];
            }
          }),
          _: 3
        }, _parent));
      } else {
        ssrRenderSlot(_ctx.$slots, "default", { scrollTop: scrollTop.value }, null, _push, _parent);
      }
      _push(`</div>`);
    };
  }
});
const AppLayout_vue_vue_type_style_index_0_lang = "";
const AppLayout_vue_vue_type_style_index_1_scoped_9c9c71f7_lang = "";
const _sfc_setup$2 = _sfc_main$2.setup;
_sfc_main$2.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/layout/AppLayout.vue");
  return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const AppLayout = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-9c9c71f7"]]);
const getNetworkType = () => {
  const n = navigator;
  const connection = n.connection;
  if (connection && connection.effectiveType) {
    return connection.effectiveType;
  }
  return "others";
};
const getNetworkCarrier = () => {
  const n = navigator;
  const connection = n.connection;
  if (connection && connection.type) {
    return connection.type;
  }
  return "empty";
};
const getNetworkRtt = () => {
  const n = navigator;
  const connection = n.connection;
  if (connection && connection.rtt) {
    return connection.rtt;
  }
  return 0;
};
let isPageLoad = true;
const getDeviceInfo = () => {
  const pageOpenType = isPageLoad ? "pageload" : "navigation";
  if (isPageLoad) {
    isPageLoad = false;
  }
  const n = navigator;
  return {
    // 网络类型
    device_network_type: getNetworkType(),
    device_network_carrier: getNetworkCarrier(),
    device_network_rtt: getNetworkRtt(),
    // 设备内存
    device_memory: n.deviceMemory ? `${n.deviceMemory}g` : "unknown",
    // 页面加载类型 "pageload" : "navigation"
    page_open_type: pageOpenType,
    // 网站 版本号
    website_version: "",
    // TODO
    // website_version: process.env.VUE_APP_VERSION || "",
    // 窗口分辨率
    device_resolution: `${window.screen.width}x${window.screen.height}`,
    device: device()
  };
};
const device = () => {
  var _a;
  const deviceInfo = navigator.userAgent;
  const deviceW = window.screen.width;
  const deviceH = window.screen.height;
  const devicePixelRatio = window.devicePixelRatio;
  const iphones = {
    1136: "iPhone5/S/SE",
    1334: "iPhone 6/6S/7/8",
    2208: "iPhone 6s/7/8 Plus",
    2436: "iPhone X/XS",
    2688: "iPhone XS MAX",
    1792: "iphone XR",
    2048: "iPad Air/Mini 2/ Mini 3/Air 2/Mini 4",
    2732: "iPad Pro"
  };
  let phoneType = "unknown";
  if (deviceInfo.indexOf("iPhone") >= 0 || deviceInfo.indexOf("iPad") >= 0) {
    const key = Math.max(deviceW, deviceH) * devicePixelRatio;
    phoneType = iphones[key];
  } else if (deviceInfo.indexOf("Android") >= 0 && deviceInfo.indexOf("Linux") >= 0) {
    const uaArr = deviceInfo.split(";");
    const type = (_a = uaArr[uaArr.length - 1]) == null ? void 0 : _a.split("Build")[0];
    if (type) {
      phoneType = type;
    }
  } else if (deviceInfo.indexOf("BB10") >= 0) {
    phoneType = "BlackBerry";
  } else if (deviceInfo.indexOf("PlayBook") >= 0) {
    phoneType = "PlayBook";
  } else if (deviceInfo.indexOf("NOKIA") >= 0 || deviceInfo.indexOf("Nokia") >= 0) {
    phoneType = "Nokia";
  }
  return phoneType;
};
const TrackApi = () => new APIAxios({
  baseURL: "http://track-log.dev.patpat.vip",
  headers: {
    accept: "*/*",
    "content-type": "application/x-www-form-urlencoded"
  },
  timeout: 6e4,
  withCredentials: false,
  interceptors: {
    requestInterceptor: (config) => {
      if (config.loading)
        ;
      const reqMethods = ["post", "put", "delete"];
      const currentMethod = config.method ? config.method.toLocaleLowerCase() : "";
      if (reqMethods.includes(currentMethod)) {
        config.data = qs.stringify(config.data);
      }
      return config;
    }
  }
});
const api = TrackApi();
const tracksRecord = (data) => {
  return api.post({
    url: "/v1/tracks/merge_track",
    data
  });
};
const tracksExposureTrack = (data) => {
  return api.post({
    url: "/v1/tracks/merge_exposure_track",
    data
  });
};
import("web-vitals").then(({ onLCP, onFID, onCLS, onFCP, onTTFB }) => {
  if (typeof window !== "undefined" && typeof window === "object") {
    onLCP(setMeasurement);
    onFID(setMeasurement);
    onCLS(setMeasurement);
    onFCP(setMeasurement);
    onTTFB(setMeasurement);
    window.addEventListener("pagehide", trackDataListener);
    window.addEventListener("visibilitychange", trackDataListener);
    window.addEventListener("beforeunload", trackDataListener);
  }
});
const _measurements = {};
let trackBaseData$1 = null;
let trackMergeData = null;
const setMeasurement = (metric) => {
  if (metric.name) {
    const metricName = metric.name.toLocaleLowerCase();
    _measurements[metricName] = metric.value;
  }
};
const trackDataListener = () => {
  tracksRecord(getTrackData());
  window.removeEventListener("pagehide", trackDataListener);
  window.removeEventListener("visibilitychange", trackDataListener);
  window.removeEventListener("beforeunload", trackDataListener);
};
const getCurrentMetrics = () => {
  if (!("fcp" in _measurements)) {
    delete _measurements.cls;
  }
  return _measurements;
};
const getTrackData = () => {
  return {
    ...trackBaseData$1,
    mergeData: JSON.stringify([
      {
        ...trackMergeData,
        type_id: 2,
        event_type: 2,
        content: JSON.stringify(getCurrentMetrics()),
        measurements: getCurrentMetrics()
      }
    ])
  };
};
const initBaseData = (trackData) => {
  if (!trackBaseData$1) {
    trackBaseData$1 = trackData;
  }
  trackBaseData$1 = trackData;
};
const initMergeData = (mergeData) => {
  if (!trackMergeData) {
    trackMergeData = mergeData;
  }
};
const metrics = {
  initBaseData,
  initMergeData,
  getCurrentMetrics
};
const trackBaseData = {
  url: "",
  // 页面url
  last_url: "",
  // 上一个页面url
  session_id: "",
  // 会话id
  user_id: 0,
  // 用户id
  landing_page: "",
  // 落地页
  landing_page_url: "",
  // 落地页
  adlk_id: 0,
  // 广告id
  new_adlink_id: 0,
  // 广告id
  position: "",
  // 坑位id
  home_position: "",
  // 首页坑位id
  source: "",
  // 广告 渠道名称 g_SOURCE
  patpat_experiments: "",
  // 实验参数 "[\"test_truefit.A\"]"
  experiments: "",
  // 实验参数 "[{\"experiment_id\":\"test_truefit\",\"variation_id\":\"A\"}]"
  abb: "",
  // 站点选择语言
  device: "",
  // 设备信息 "iPhone 6/6S/7/8"
  device_language: "",
  // 设备语言信息 "zh-CN"
  unique_session_id: "",
  // 设备id
  patpat_platform: "",
  // ios android wap wap-test
  is_automated: 0,
  //
  position_content: "",
  // 坑位内容 JSON 字符串
  home_position_content: "",
  // 首页坑位内容 JSON 字符串
  view_platform: "",
  // ios android wap wap-test
  last_page_position_id: "",
  // 上个页面坑位id
  last_page_position_content: "",
  // 上个页面坑位 内容
  ad_adlink_id: 0,
  // 广告id
  root_page_position_id: "",
  // 首页坑位id
  root_page_position_content: "",
  // 首页坑位 内容
  last_tid: "",
  // 上个页面坑位tid
  pat_device_language: "",
  // 设备语言 "zh-CN"
  is_back: 0,
  // 是否返回
  user_tag: "",
  // 用户标签
  page_name: "",
  // 页面名称
  app_version: "",
  // 网站发版本 版本号
  device_id: "",
  // 设备id
  app_country: "",
  // 用户选择站点国家
  app_language: "",
  // 用户选择站点语言
  app_currency: "",
  // 用户选择 货币
  ad_channel: "",
  // 广告渠道名称 g_SOURCE
  product_id: 0,
  // 商品id
  sku_id: 0,
  // sku id
  pat_page_url: "",
  // 页面url 不带 query 和 host
  url_query: "",
  // 页面url  query
  last_page_duration: 0,
  // 上一个页面 浏览时长
  deep: 0,
  // 页面浏览深度
  ab_experiments: "",
  // 实验信息 "[\"test_truefit.A\"]"
  site_abb: "",
  // 站点
  app_useragent: "",
  // ua
  device_network_type: "",
  // 网络状态
  device_network_carrier: "",
  // 网络状态
  device_network_rtt: 0,
  // 网络状态
  device_memory: "",
  // 网络状态
  page_open_type: "",
  // 页面加载类型 pageload | navigation
  website_version: "",
  // 版本信息
  device_resolution: "",
  // 分辨率
  mergeData: []
};
const mergeExposureData = [];
const mergeActionData = [];
let pageViewTime = 0;
const getABTestExperiments = (abTestStr, isObj = true) => {
  const abTestArr = abTestStr ? abTestStr.split(",") : [];
  if (isObj) {
    const experiments = abTestArr.map((item) => {
      const abTestSplit = item.split(".");
      if (abTestSplit.length >= 2) {
        return {
          experiment_id: abTestSplit[0],
          variation_id: abTestSplit[1]
        };
      }
      return {};
    });
    return JSON.stringify(experiments);
  } else {
    return JSON.stringify(abTestArr);
  }
};
const useTrack = () => {
  onBeforeRouteUpdate((to, from, next) => {
    postTrackData();
    postExposureTrack();
    next(true);
  });
  onBeforeRouteLeave((to, from, next) => {
    postTrackData();
    postExposureTrack();
    next(true);
  });
  onMounted(() => {
    pageViewTime = Date.now();
    initTrackData();
    appendPageTrackData({});
    postTrackData();
  });
  onUnmounted(() => {
    postTrackData();
    postExposureTrack();
    setSessionStorage("page_view_time", Date.now() - pageViewTime);
  });
  onActivated(() => {
    pageViewTime = Date.now();
  });
  onDeactivated(() => {
    setSessionStorage("page_view_time", Date.now() - pageViewTime);
  });
};
const appendPageTrackData = (pagePositionContent = {}) => {
  const router = useRoute$1();
  const routerName = String(router.name) || "unnamed";
  trackBaseData.measurements = JSON.stringify(metrics.getCurrentMetrics());
  const now = Date.now();
  const eventName = trackBaseData.page_name;
  const tid = v4();
  const obj = {
    type_id: 1,
    event_type: 1,
    event_name: eventName.toLocaleLowerCase().replace("-", "_"),
    // 名字不是坑位事件
    event_id: routerName,
    pat_page_position_id: handlePositionId("page", trackBaseData.page_name),
    timestamp: now,
    event_created_at: now,
    tid,
    content: "{}",
    page_position_content: "{}"
  };
  const lastClickPositionContent = getSessionStorage("last_click_position_content") || {};
  const pageViewTime2 = getSessionStorage("page_view_time") || 0;
  let lastPositionContent = { page_view_time: pageViewTime2, ...lastClickPositionContent };
  const assginPc = {};
  if (routerName === "search") {
    assginPc.keyword = router.query.keyword;
  }
  const currentPositionContent = { ...assginPc };
  if (trackBaseData.position && trackBaseData.last_page_position_content && checkIsJSON(trackBaseData.last_page_position_content)) {
    lastPositionContent = { ...JSON.parse(trackBaseData.last_page_position_content), ...lastPositionContent };
  }
  obj.content = JSON.stringify({
    current_position_content: currentPositionContent,
    last_position_content: lastPositionContent
  });
  obj.page_position_content = JSON.stringify(currentPositionContent);
  mergeActionData.push(obj);
  metrics.initMergeData(obj);
  if (window.__PATPAT_DATA_TRACK__) {
    window.__PATPAT_DATA_TRACK__({ ...trackBaseData, ...obj });
  }
};
const appendClickTrackData = (pagePositionId, eventName = "unknown", pagePositionContent = {}) => {
  if (pagePositionId) {
    if (typeof eventName !== "string" || !eventName) {
      console.warn("click事件上报缺失参数 event_name", eventName);
      eventName = "unknown";
    }
    const now = Date.now();
    const tid = v4();
    eventName = trackBaseData.page_name ? trackBaseData.page_name + "_" + eventName : eventName;
    const obj = {
      type_id: 2,
      event_type: 2,
      event_id: pagePositionId,
      event_name: eventName.toLocaleLowerCase().replace("-", "_"),
      timestamp: now,
      event_created_at: now,
      content: JSON.stringify(pagePositionContent || {}),
      pat_page_position_id: handlePositionId(pagePositionId.replace(new RegExp(`^${trackBaseData.page_name}_`), ""), trackBaseData.page_name),
      page_position_content: "{}",
      tid
    };
    const pageViewTime2 = getSessionStorage("page_view_time") || 0;
    let currentPositionContent = {};
    if (typeof pagePositionContent === "string" && checkIsJSON(pagePositionContent)) {
      currentPositionContent = JSON.parse(pagePositionContent);
    } else {
      currentPositionContent = pagePositionContent;
    }
    let lastPositionContent = { page_view_time: pageViewTime2 };
    if (trackBaseData.position && trackBaseData.position_content && checkIsJSON(trackBaseData.position_content)) {
      lastPositionContent = { ...lastPositionContent, ...JSON.parse(trackBaseData.position_content) };
    }
    obj.content = JSON.stringify({
      current_position_content: currentPositionContent,
      last_position_content: lastPositionContent
    });
    obj.page_position_content = JSON.stringify(currentPositionContent);
    setSessionStorage("last_tid", tid);
    mergeActionData.push(obj);
    if (window.__PATPAT_DATA_TRACK__) {
      window.__PATPAT_DATA_TRACK__({ ...trackBaseData, ...obj });
    }
  } else {
    console.warn("click事件上报缺失参数 page_position_id", pagePositionId);
  }
};
const appendExposureData = (pagePositionId, eventName, pagePositionContent) => {
  if (pagePositionId) {
    if (typeof eventName !== "string" || !eventName) {
      console.warn("Exposure 事件上报缺失参数 event_name", eventName);
      eventName = "unknown";
    }
    if (typeof pagePositionContent !== "string") {
      pagePositionContent = JSON.stringify(pagePositionContent || {});
    }
    const now = Date.now();
    eventName = trackBaseData.page_name ? trackBaseData.page_name + "_" + eventName : eventName;
    const ed = {
      event_type: 3,
      type_id: 3,
      event_id: pagePositionId,
      position_id: pagePositionId,
      content: "{}",
      tid: v4(),
      timestamp: now,
      event_created_at: now,
      position_content: pagePositionContent,
      event_name: eventName.toLocaleLowerCase().replace("-", "_"),
      pat_page_position_id: handlePositionId(pagePositionId.replace(new RegExp(`^${trackBaseData.page_name}_`), ""), trackBaseData.page_name),
      page_position_content: pagePositionContent
    };
    mergeExposureData.push(ed);
    if (window.__PATPAT_DATA_TRACK__) {
      window.__PATPAT_DATA_TRACK__({ ...trackBaseData, ...ed });
    }
  } else {
    console.warn("pagePositionId is empty!", pagePositionId, eventName, pagePositionContent);
  }
};
const postTrackData = (sendBeacon = false) => {
  if (mergeActionData.length === 0)
    return;
  const mergeData = { mergeData: JSON.stringify(mergeActionData) };
  const data = { ...trackBaseData, ...mergeData };
  if (navigator.sendBeacon && sendBeacon) {
    const fromData = new FormData();
    for (const [key, value] of Object.entries(data)) {
      fromData.append(key, String(value));
    }
    navigator.sendBeacon("/trackApi/v1/tracks/merge_track", fromData);
  } else {
    tracksRecord(data);
  }
  mergeActionData.length = 0;
};
const postExposureTrack = (sendBeacon = false) => {
  if (mergeExposureData.length === 0)
    return;
  const mergeData = { mergeData: JSON.stringify(mergeExposureData) };
  const data = { ...trackBaseData, ...mergeData };
  if (navigator.sendBeacon && sendBeacon) {
    const fromData = new FormData();
    for (const [key, value] of Object.entries(data)) {
      fromData.append(key, String(value));
    }
    navigator.sendBeacon("/trackApi/v1/tracks/merge_exposure_track", fromData);
  } else {
    tracksExposureTrack(data);
  }
  mergeExposureData.length = 0;
};
const initTrackData = () => {
  var _a;
  const userInfoStore = useUserInfoStore();
  const router = useRoute$1();
  const store = useMainStore();
  const url = window.location.href;
  const landingPageUrl = getLocalStore("landing_page") || getCookie("landing_page");
  const lastPagePositionId = getSessionStorage("last_page_position_id") || "";
  const lastPagePositionContent = JSON.stringify(getSessionStorage("last_click_position_content") || {});
  const rootPagePositionId = getSessionStorage("home_position") || "";
  const rootPagePositionContent = JSON.stringify(getSessionStorage("home_position_content") || {});
  const adAdlinkId = getCookie("adlk_id") || "";
  const adChannel = getCookie("g_SOURCE") || "";
  const newAdAdlinkId = getCookie("new_adlk_id") || "";
  delRootDomainCookie("new_adlk_id");
  const lastTid = getSessionStorage("last_tid") || "";
  const deviceLanguage = (navigator.languages && navigator.languages.length > 0 ? navigator.languages[0] : "") || "";
  const userTag = "";
  const pageName = router.meta && router.meta.trackPageName ? router.meta.trackPageName.toLocaleLowerCase() : "others";
  const appVersion = "0.1.10";
  const deviceId = getCookie("unique_session_id") || "";
  const appCountry = ((_a = store.getCurrentCountry) == null ? void 0 : _a.country_name) || "";
  const appCurrency = store.currencyCode;
  const appLanguage = store.language;
  const siteAbb = store.siteAbb;
  let productId = "";
  if (pageName === "product_detail" && router.params && router.params.name) {
    productId = router.params.name.split("-").pop() || "";
  }
  const skuId = "";
  const pageUrl = location.pathname;
  const urlQuery = location.search;
  const lastPageDuration = getSessionStorage("page_view_time") || 0;
  const abExperiments = getABTestExperiments(store.abTestStr, false);
  const appUseragent = navigator.userAgent;
  const patpatPlatform = "wap-test";
  trackBaseData.last_url = trackBaseData.url;
  trackBaseData.url = url;
  trackBaseData.session_id = getSessionStorage("track_session_id") || "";
  trackBaseData.user_id = userInfoStore.userId || getCookie("userId") || 0;
  trackBaseData.landing_page = landingPageUrl;
  trackBaseData.landing_page_url = getLocalStore("landing_page") || getCookie("landing_page");
  trackBaseData.adlk_id = adAdlinkId;
  trackBaseData.new_adlink_id = newAdAdlinkId;
  trackBaseData.position = getSessionStorage("last_click_position") || "";
  trackBaseData.home_position = rootPagePositionId;
  trackBaseData.source = adChannel;
  trackBaseData.patpat_experiments = abExperiments;
  trackBaseData.experiments = getABTestExperiments(store.abTestStr);
  trackBaseData.experiments = "";
  trackBaseData.abb = appLanguage;
  trackBaseData.device_language = deviceLanguage;
  trackBaseData.unique_session_id = deviceId;
  trackBaseData.patpat_platform = patpatPlatform;
  trackBaseData.is_automated = navigator.webdriver ? 1 : 0;
  trackBaseData.position_content = lastPagePositionContent;
  trackBaseData.home_position_content = rootPagePositionContent;
  trackBaseData.view_platform = patpatPlatform;
  trackBaseData.last_page_position_id = lastPagePositionId;
  trackBaseData.last_page_position_content = lastPagePositionContent;
  trackBaseData.landing_page_url = landingPageUrl;
  trackBaseData.ad_adlink_id = adAdlinkId;
  trackBaseData.root_page_position_id = rootPagePositionId;
  trackBaseData.root_page_position_content = rootPagePositionContent;
  trackBaseData.last_tid = lastTid;
  trackBaseData.pat_device_language = deviceLanguage;
  trackBaseData.is_back = 0;
  trackBaseData.user_tag = userTag;
  trackBaseData.page_name = pageName;
  trackBaseData.app_version = appVersion;
  trackBaseData.device_id = deviceId;
  trackBaseData.app_country = appCountry;
  trackBaseData.app_currency = appCurrency;
  trackBaseData.app_language = appLanguage;
  trackBaseData.ad_channel = adChannel;
  trackBaseData.product_id = productId;
  trackBaseData.sku_id = skuId;
  trackBaseData.pat_page_url = pageUrl;
  trackBaseData.url_query = urlQuery;
  trackBaseData.last_page_duration = lastPageDuration;
  trackBaseData.deep = history.length - 1;
  trackBaseData.ab_experiments = abExperiments;
  trackBaseData.site_abb = siteAbb;
  trackBaseData.app_useragent = appUseragent;
  const deviceInfo = getDeviceInfo();
  trackBaseData.device = deviceInfo.device;
  trackBaseData.device_memory = deviceInfo.device_memory;
  trackBaseData.device_network_carrier = deviceInfo.device_network_carrier;
  trackBaseData.device_network_rtt = deviceInfo.device_network_rtt;
  trackBaseData.device_network_type = deviceInfo.device_network_type;
  trackBaseData.device_resolution = deviceInfo.device_resolution;
  trackBaseData.website_version = deviceInfo.website_version;
  trackBaseData.page_open_type = deviceInfo.page_open_type;
  const nativeInfo = useNativeInfoStore().getNativeInfo();
  if (nativeInfo.isFromApp) {
    if (nativeInfo.userId) {
      trackBaseData.user_id = nativeInfo.userId;
    }
    if (nativeInfo.country) {
      trackBaseData.url = url + `&country=${nativeInfo.country}`;
    }
    if (nativeInfo.homePosition) {
      trackBaseData.home_position = nativeInfo.homePosition;
      trackBaseData.root_page_position_id = nativeInfo.homePosition;
    }
    if (nativeInfo.homePosition) {
      trackBaseData.home_position_content = nativeInfo.homePositionContent;
      trackBaseData.root_page_position_content = nativeInfo.homePositionContent;
    }
    if (nativeInfo.deviceID) {
      trackBaseData.unique_session_id = nativeInfo.deviceID;
      trackBaseData.device_id = nativeInfo.deviceID;
    }
    if (nativeInfo.platform) {
      if (nativeInfo.isIos) {
        trackBaseData.patpat_platform = "ios";
        trackBaseData.view_platform = "ios";
      } else if (nativeInfo.isAndroid) {
        trackBaseData.patpat_platform = "android";
        trackBaseData.view_platform = "android";
      }
    }
    if (nativeInfo.lastUrl) {
      trackBaseData.last_url = nativeInfo.lastUrl;
    }
    if (nativeInfo.pagePosition) {
      trackBaseData.position = nativeInfo.pagePosition;
      trackBaseData.last_page_position_id = nativeInfo.pagePosition;
    }
    if (nativeInfo.pagePositionContent) {
      trackBaseData.position_content = nativeInfo.pagePositionContent;
      trackBaseData.last_page_position_content = nativeInfo.pagePositionContent;
    }
    if (nativeInfo.experiments) {
      trackBaseData.patpat_experiments = nativeInfo.experiments;
    }
    if (nativeInfo.adlinkId) {
      trackBaseData.adlk_id = nativeInfo.adlinkId;
      trackBaseData.ad_adlink_id = nativeInfo.adlinkId;
    }
    if (nativeInfo.sessionId)
      trackBaseData.session_id = nativeInfo.sessionId;
    if (nativeInfo.pageViewTime) {
      const pageViewTime2 = getSessionStorage("page_view_time");
      !pageViewTime2 && setSessionStorage("page_view_time", nativeInfo.pageViewTime);
      trackBaseData.last_page_duration = nativeInfo.pageViewTime;
    }
  }
};
function useMountedHook(hook, options = { activated: false }) {
  let isMounted = false;
  const nativeInfoStore = useNativeInfoStore();
  onMounted(() => {
    hook();
    if (nativeInfoStore.isFromApp) {
      useEventListener$1(document, "visibilitychange", () => {
        isMounted && document.visibilityState === "visible" && hook();
      });
    }
    isMounted = true;
  });
  if (options.activated && !nativeInfoStore.isFromApp) {
    onActivated(() => {
      isMounted && hook();
    });
  }
}
const __default__$8 = defineComponent({
  name: "TicketRecords",
  components: { HelpCenterHeader, TicketListItem, CircleLoadingIcon, PullRefresh, PatLink: __default__$a, PlusIcon, AppLayout },
  beforeRouteEnter(to, from, next) {
    {
      next();
    }
  }
});
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  ...__default__$8,
  __ssrInlineRender: true,
  setup(__props) {
    useTrack();
    const trackPageName = computed(() => {
      var _a;
      const name2 = ((_a = ticketRecordsRoute.meta) == null ? void 0 : _a.trackPageName) || "";
      return name2 ? name2 + "_" : "";
    });
    const { appContext } = getCurrentInstance();
    const i18n2 = useI18n();
    const t = i18n2.t;
    const dataList = ref([]);
    const helpCenterHeaderRef = ref();
    const scrollContainerRef = ref();
    const nativeInfoStore = useNativeInfoStore();
    const state = reactive({
      page: 1,
      page_size: 10,
      help_center_status: "",
      total: 0,
      scrollPosition: 0,
      isFinished: false,
      firstLoadend: false,
      loading: true,
      refreshDistance: 50,
      isReachBottom: false
    });
    const btnPosition = computed(() => {
      return ["ar", "he"].includes(i18n2.locale.value) ? { left: "16px" } : { right: "16px" };
    });
    function errorMessageDialog(err) {
      const { destroy } = renderComponent({
        component: MessageDialog,
        appContext,
        props: {
          content: err.message,
          showCancelButton: false,
          okText: "Close",
          onClick: () => destroy(),
          onOk: () => destroy()
        }
      });
    }
    function loadData(params) {
      if (state.isFinished)
        return Promise.reject("finished");
      state.loading = true;
      const page_size = (params == null ? void 0 : params.page_size) || state.page_size;
      const page = (params == null ? void 0 : params.page) || state.page;
      return getTicketRecordsListApi({ page, page_size, help_center_status: state.help_center_status }).then((content) => {
        const records = content.records || [];
        const sortAllRecords = page === 1 ? records.concat(dataList.value) : dataList.value.concat(records);
        const ids = [...new Set(sortAllRecords.map((r) => r.id))];
        const concatRecors = records.concat(dataList.value);
        dataList.value = ids.map((id) => concatRecors.find((item) => item.id === id));
        state.total = content.total;
        state.isReachBottom = false;
        state.isFinished = state.total === dataList.value.length;
        state.firstLoadend = true;
        return content;
      }).catch((err) => {
        state.firstLoadend = true;
        errorMessageDialog(err);
        return Promise.reject(err);
      }).finally(() => {
        state.loading = false;
        state.firstLoadend = true;
      });
    }
    function onRefresh(done) {
      if (!state.loading) {
        state.isReachBottom = false;
        state.isFinished = false;
        loadData({ page_size: Math.min(dataList.value.length, 50), page: 1 }).then((content) => {
          state.total = content.total;
          state.isFinished = state.total === dataList.value.length;
        }).finally(() => done == null ? void 0 : done());
      } else {
        done == null ? void 0 : done();
      }
    }
    function onClearRedDot(item) {
      var _a;
      if (((_a = item.case_reply_vo_latest) == null ? void 0 : _a.msg_read) === 0) {
        item.case_reply_vo_latest.msg_read = 1;
      }
    }
    function bindScrollEvent() {
      const container = scrollContainerRef.value;
      if (container) {
        state.scrollPosition = container.scrollTop;
        const scrollDistance = container.scrollHeight - container.clientHeight;
        if (!state.loading) {
          state.isReachBottom = scrollDistance <= container.scrollTop + 20;
        }
        if (state.isReachBottom && !state.isFinished && !state.loading) {
          loadData({ page: state.page += 1 }).catch((err) => {
            if (err !== "finished") {
              state.page -= 1;
            }
          });
        }
      }
    }
    onActivated(() => {
      var _a;
      (_a = scrollContainerRef.value) == null ? void 0 : _a.scrollTo(0, state.scrollPosition);
      if (state.firstLoadend) {
        state.isFinished = false;
        loadData({ page_size: Math.min(dataList.value.length + 1, 50), page: 1 });
      }
    });
    useMountedHook(() => {
      var _a;
      (_a = scrollContainerRef.value) == null ? void 0 : _a.scrollTo(0, state.scrollPosition);
      const lastListLength = dataList.value.length;
      loadData({ page: 1 }).finally(() => {
        var _a2;
        if (lastListLength !== dataList.value.length) {
          (_a2 = scrollContainerRef.value) == null ? void 0 : _a2.scrollTo(0, 0);
        }
      });
    });
    onMounted(() => {
      setTimeout(() => {
        useEventListener$1(scrollContainerRef.value, "scroll", bindScrollEvent);
      }, 16);
    });
    return (_ctx, _push, _parent, _attrs) => {
      const _component_PatLink = resolveComponent("PatLink");
      const _directive_track = resolveDirective("track");
      _push(ssrRenderComponent(AppLayout, mergeProps({ class: "ticket-records" }, _attrs), {
        default: withCtx((_2, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(ssrRenderComponent(HelpCenterHeader, {
              ref_key: "helpCenterHeaderRef",
              ref: helpCenterHeaderRef,
              "left-btn-event-name": trackPageName.value + "back",
              title: unref(t)("helpCenter.ticket")
            }, null, _parent2, _scopeId));
            if (!state.firstLoadend && !dataList.value.length) {
              _push2(ssrRenderComponent(unref(CircleLoadingIcon), {
                width: 50,
                height: 50,
                class: "loading-icon"
              }, null, _parent2, _scopeId));
            } else {
              _push2(`<!---->`);
            }
            _push2(ssrRenderComponent(PullRefresh, {
              "scroll-dom-id": "refresh-service-list-wrap",
              onRefresh
            }, {
              default: withCtx((_22, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`<div id="refresh-service-list-wrap" class="ticket-list" style="${ssrRenderStyle({ height: `calc(100vh - ${56 + unref(nativeInfoStore).iphoneStatebarHeight * 1.5}px)` })}" data-v-3c6f6e51${_scopeId2}>`);
                  if (dataList.value.length === 0 && state.isFinished) {
                    _push3(`<div class="empty-text" data-v-3c6f6e51${_scopeId2}><p class="content2" data-v-3c6f6e51${_scopeId2}>${ssrInterpolate(unref(t)("account.notification.empty"))}</p></div>`);
                  } else {
                    _push3(`<!---->`);
                  }
                  if (dataList.value.length) {
                    _push3(`<!--[-->`);
                    ssrRenderList(dataList.value, (item, index2) => {
                      _push3(ssrRenderComponent(TicketListItem, mergeProps({
                        key: index2,
                        class: "ticket-list-item",
                        "ticket-item": item,
                        onClearDot: ($event) => onClearRedDot(item)
                      }, ssrGetDirectiveProps(_ctx, _directive_track, {
                        pId: trackPageName.value + "item-" + String(index2 + 1).padStart(3, "0"),
                        eventName: "item",
                        pContent: { case_id: item.case_reply_vo_latest.case_id, id: item.id }
                      }, void 0, {
                        click: true,
                        exposure: true
                      })), null, _parent3, _scopeId2));
                    });
                    _push3(`<!--]-->`);
                  } else {
                    _push3(`<!---->`);
                  }
                  _push3(`</div>`);
                } else {
                  return [
                    createVNode("div", {
                      id: "refresh-service-list-wrap",
                      ref_key: "scrollContainerRef",
                      ref: scrollContainerRef,
                      class: "ticket-list",
                      style: { height: `calc(100vh - ${56 + unref(nativeInfoStore).iphoneStatebarHeight * 1.5}px)` }
                    }, [
                      dataList.value.length === 0 && state.isFinished ? (openBlock(), createBlock("div", {
                        key: 0,
                        class: "empty-text"
                      }, [
                        createVNode("p", { class: "content2" }, toDisplayString(unref(t)("account.notification.empty")), 1)
                      ])) : createCommentVNode("", true),
                      dataList.value.length ? (openBlock(true), createBlock(Fragment, { key: 1 }, renderList(dataList.value, (item, index2) => {
                        return withDirectives((openBlock(), createBlock(TicketListItem, {
                          key: index2,
                          class: "ticket-list-item",
                          "ticket-item": item,
                          onClearDot: ($event) => onClearRedDot(item)
                        }, null, 8, ["ticket-item", "onClearDot"])), [
                          [
                            _directive_track,
                            {
                              pId: trackPageName.value + "item-" + String(index2 + 1).padStart(3, "0"),
                              eventName: "item",
                              pContent: { case_id: item.case_reply_vo_latest.case_id, id: item.id }
                            },
                            void 0,
                            {
                              click: true,
                              exposure: true
                            }
                          ]
                        ]);
                      }), 128)) : createCommentVNode("", true)
                    ], 4)
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(_component_PatLink, mergeProps({
              style: [
                state.firstLoadend ? null : { display: "none" },
                btnPosition.value
              ],
              to: { name: unref(submitTicketRoute).name },
              class: "new-btn"
            }, ssrGetDirectiveProps(_ctx, _directive_track, { pId: trackPageName.value + "submit_button", eventName: "submit_button" }, void 0, {
              click: true,
              exposure: true
            })), {
              default: withCtx((_22, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(ssrRenderComponent(unref(PlusIcon), {
                    width: 28,
                    height: 28,
                    fill: "#fff"
                  }, null, _parent3, _scopeId2));
                } else {
                  return [
                    createVNode(unref(PlusIcon), {
                      width: 28,
                      height: 28,
                      fill: "#fff"
                    })
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            if (state.isReachBottom && !state.isFinished) {
              _push2(ssrRenderComponent(unref(CircleLoadingIcon), {
                width: 50,
                height: 50,
                class: "next-loading"
              }, null, _parent2, _scopeId));
            } else {
              _push2(`<!---->`);
            }
          } else {
            return [
              createVNode(HelpCenterHeader, {
                ref_key: "helpCenterHeaderRef",
                ref: helpCenterHeaderRef,
                "left-btn-event-name": trackPageName.value + "back",
                title: unref(t)("helpCenter.ticket")
              }, null, 8, ["left-btn-event-name", "title"]),
              !state.firstLoadend && !dataList.value.length ? (openBlock(), createBlock(unref(CircleLoadingIcon), {
                key: 0,
                width: 50,
                height: 50,
                class: "loading-icon"
              })) : createCommentVNode("", true),
              createVNode(PullRefresh, {
                "scroll-dom-id": "refresh-service-list-wrap",
                onRefresh
              }, {
                default: withCtx(() => [
                  createVNode("div", {
                    id: "refresh-service-list-wrap",
                    ref_key: "scrollContainerRef",
                    ref: scrollContainerRef,
                    class: "ticket-list",
                    style: { height: `calc(100vh - ${56 + unref(nativeInfoStore).iphoneStatebarHeight * 1.5}px)` }
                  }, [
                    dataList.value.length === 0 && state.isFinished ? (openBlock(), createBlock("div", {
                      key: 0,
                      class: "empty-text"
                    }, [
                      createVNode("p", { class: "content2" }, toDisplayString(unref(t)("account.notification.empty")), 1)
                    ])) : createCommentVNode("", true),
                    dataList.value.length ? (openBlock(true), createBlock(Fragment, { key: 1 }, renderList(dataList.value, (item, index2) => {
                      return withDirectives((openBlock(), createBlock(TicketListItem, {
                        key: index2,
                        class: "ticket-list-item",
                        "ticket-item": item,
                        onClearDot: ($event) => onClearRedDot(item)
                      }, null, 8, ["ticket-item", "onClearDot"])), [
                        [
                          _directive_track,
                          {
                            pId: trackPageName.value + "item-" + String(index2 + 1).padStart(3, "0"),
                            eventName: "item",
                            pContent: { case_id: item.case_reply_vo_latest.case_id, id: item.id }
                          },
                          void 0,
                          {
                            click: true,
                            exposure: true
                          }
                        ]
                      ]);
                    }), 128)) : createCommentVNode("", true)
                  ], 4)
                ]),
                _: 1
              }),
              withDirectives((openBlock(), createBlock(_component_PatLink, {
                to: { name: unref(submitTicketRoute).name },
                class: "new-btn",
                style: btnPosition.value
              }, {
                default: withCtx(() => [
                  createVNode(unref(PlusIcon), {
                    width: 28,
                    height: 28,
                    fill: "#fff"
                  })
                ]),
                _: 1
              }, 8, ["to", "style"])), [
                [vShow, state.firstLoadend],
                [
                  _directive_track,
                  { pId: trackPageName.value + "submit_button", eventName: "submit_button" },
                  void 0,
                  {
                    click: true,
                    exposure: true
                  }
                ]
              ]),
              state.isReachBottom && !state.isFinished ? (openBlock(), createBlock(unref(CircleLoadingIcon), {
                key: 1,
                width: 50,
                height: 50,
                class: "next-loading"
              })) : createCommentVNode("", true)
            ];
          }
        }),
        _: 1
      }, _parent));
    };
  }
});
const TicketRecords_vue_vue_type_style_index_0_scoped_3c6f6e51_lang = "";
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/views/helpCenter/TicketRecords.vue");
  return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const ServiceMessageView = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-3c6f6e51"]]);
const TicketRecords = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: ServiceMessageView
}, Symbol.toStringTag, { value: "Module" }));
function notNullable(o) {
  return o !== null && o !== void 0;
}
const cachePages = [ServiceMessageView.name].filter(notNullable);
const useW2aStore = defineStore("w2a", () => {
  const isShowNewBannerStatus = ref(false);
  const showW2a = ref(false);
  const mainStore = useMainStore();
  const isShowW2aFristTimePopup = ref(false);
  const showEmailSubscribePopup = ref(false);
  const setNewBannerStatus = (res) => {
    isShowNewBannerStatus.value = res;
  };
  const userChooseSetting = reactive({
    type: "",
    addressId: 0,
    country: "",
    cancelShowW2A: false
  });
  const setIsShowW2aFristTimePopup = (res) => {
    isShowW2aFristTimePopup.value = res;
  };
  const setUserChooseSetting = (data) => {
    userChooseSetting.type = data.type;
    userChooseSetting.addressId = data.addressId || userChooseSetting.addressId;
    userChooseSetting.country = data.country;
    userChooseSetting.cancelShowW2A = data.cancelShowW2A || false;
  };
  const setEmailSubscribePopupStatus = (data) => {
    showEmailSubscribePopup.value = data;
  };
  const setShowW2a = () => {
    const site = mainStore.siteAbb;
    const channelNames = ["Newsbreak", "Tiktok", "Pinterest"].indexOf(getCookie("g_SOURCE")) >= 0;
    const adlkIds = ["2598010", "3787356"].indexOf(getCookie("adlk_id")) >= 0;
    const hSite = [].indexOf(site) >= 0;
    const status = channelNames || adlkIds || hSite;
    const isUkTikTok = getCookie("g_SOURCE") === "Tiktok" && site === "uk";
    showW2a.value = !status || isUkTikTok;
  };
  return {
    showW2a,
    userChooseSetting,
    isShowW2aFristTimePopup,
    isShowNewBannerStatus,
    showEmailSubscribePopup,
    setNewBannerStatus,
    setIsShowW2aFristTimePopup,
    setUserChooseSetting,
    setEmailSubscribePopupStatus,
    setShowW2a
  };
});
let i18n;
const SUPPORT_LOCALES = langs.map((lang) => lang.abbreviation);
function getLocale() {
  return i18n.global.locale.value;
}
function setupI18n(options = { locale: "en", legacy: false }) {
  if (i18n) {
    return i18n;
  }
  i18n = createI18n(options);
  options.locale && setI18nLanguage(options.locale);
  return i18n;
}
async function setI18nLanguage(locale) {
  if (!i18n.global.availableLocales.includes(locale)) {
    await loadLocaleMessages(locale);
  }
  i18n.global.locale.value = locale;
  return locale;
}
const getResourceMessages = (r) => r.default || r;
async function loadLocaleMessages(locale) {
  const messages = await import(
    /* @vite-ignore */
    `../locales/${locale}.json`
  ).then(getResourceMessages);
  i18n.global.setLocaleMessage(locale, messages);
  return nextTick();
}
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "App",
  __ssrInlineRender: true,
  setup(__props) {
    const mainStore = useMainStore();
    const userInfoStore = useUserInfoStore();
    const nativeInfo = useNativeInfoStore();
    useL10n();
    const w2aStore = useW2aStore();
    const { t } = useI18n();
    useRouter();
    {
      const ctx = useSSRContext();
      ctx.title = t("common.mate_title");
      ctx.meta.keywords = t("common.mate_keywords");
      ctx.meta.description = t("common.mate_description");
      mainStore.initMainStore(ctx);
      nativeInfo.initStore(ctx.initAppInfo);
      setI18nLanguage(ctx.siteInfo.currentLang);
    }
    onServerPrefetch(async () => {
      await userInfoStore.getUserNavigation();
    });
    onActivated(async () => {
      const token = getCookie("token");
      const nativeInfoStore = useNativeInfoStore();
      if (token) {
        const loginStatus = getCookie("loginStatus");
        if (token && loginStatus === "true") {
          const userInfo = await getUserInfo();
          userInfoStore.setUserInfo(userInfo);
        } else {
          userInfoStore.setUserInfo({
            user_id: getCookie("userId"),
            token
          });
        }
      } else if (!nativeInfoStore.isFromApp && !token) {
        setRootDomainCookie("loginStatus", false);
        const guestUser = await guestLogin();
        userInfoStore.setUserInfo(guestUser);
      }
    });
    onBeforeMount(async () => {
      const nativeInfoStore = useNativeInfoStore();
      if (!nativeInfoStore.isFromApp) {
        document.documentElement.classList.add("iswap");
      } else if (nativeInfoStore.isIos) {
        document.documentElement.classList.add("isios");
      } else if (nativeInfoStore.isAndroid) {
        document.documentElement.classList.add("isandroid");
      }
    });
    onMounted(() => {
      setTimeout(() => {
        w2aStore.setShowW2a();
      }, 2e3);
    });
    return (_ctx, _push, _parent, _attrs) => {
      const _component_RouterView = resolveComponent("RouterView");
      _push(ssrRenderComponent(_component_RouterView, _attrs, {
        default: withCtx(({ Component, route: route2 }, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(``);
            ssrRenderSuspense(_push2, {
              default: () => {
                ssrRenderVNode(_push2, createVNode(resolveDynamicComponent(Component), {
                  key: route2.fullPath
                }, null), _parent2, _scopeId);
              },
              fallback: () => {
                _push2(`loading.....`);
              },
              _: 2
            });
          } else {
            return [
              (openBlock(), createBlock(KeepAlive, { include: unref(cachePages) }, [
                (openBlock(), createBlock(Suspense, null, {
                  default: withCtx(() => [
                    (openBlock(), createBlock(resolveDynamicComponent(Component), {
                      key: route2.fullPath
                    }))
                  ]),
                  fallback: withCtx(() => [
                    createTextVNode("loading.....")
                  ]),
                  _: 2
                }, 1024))
              ], 1032, ["include"]))
            ];
          }
        }),
        _: 1
      }, _parent));
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/App.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const brandStoryRoute = {
  path: "/app-nested/brand-story",
  name: "BrandStory",
  component: () => import("./assets/BrandStory-ecf87fa0.js"),
  meta: {
    trackPageName: "brand_story"
  }
};
const appNestedRoute = [brandStoryRoute];
const trackyourorderRoute$1 = {
  path: "/guest/trackyourorder",
  name: "TrackYourOrder",
  component: () => import("./assets/TrackYourOrder-c5517992.js"),
  meta: {
    trackPageName: "guest_trackyourorder"
  }
};
const landingPageRoute = [trackyourorderRoute$1];
const trackyourorderRoute = {
  path: "/product/:name.html",
  name: "product_details",
  component: () => import("./assets/ProductDetails-8547b20d.js"),
  meta: {
    trackPageName: "product_details"
  }
};
const productRoute = [trackyourorderRoute];
const routes = [...helpCenterRoutes, ...appNestedRoute, ...landingPageRoute, ...productRoute];
function localizedRouteConfig(routes2) {
  const _route = routes2.map((route2) => ({ ...route2 }));
  const langPath = "/:lang([a-z]{2,2})?";
  _route.forEach((route2) => {
    if (!route2.path.includes(langPath)) {
      route2.path = langPath + route2.path;
    }
    if (Array.isArray(route2.alias)) {
      route2.alias = route2.alias.map((url) => {
        if (!url.includes(langPath)) {
          return langPath + url;
        }
        return url;
      });
    } else if (typeof route2.alias === "string") {
      if (!route2.alias.includes(langPath)) {
        route2.alias = langPath + route2.alias;
      }
    }
    if (route2.children) {
      route2.children = localizedRouteConfig(route2.children);
    }
  });
  return _route;
}
function createRouter(i18n2) {
  const locale = getLocale();
  const langRoutes = localizedRouteConfig(routes);
  const router = createRouter$1({
    // use appropriate history implementation for server/client
    // true is injected by Vite.
    history: createMemoryHistory(),
    routes: langRoutes,
    scrollBehavior(to, _from, savedPosition) {
      if (to.hash) {
        return {
          el: to.hash,
          behavior: "smooth"
        };
      }
      if (savedPosition) {
        return savedPosition;
      } else {
        return { top: 0 };
      }
    }
  });
  router.beforeEach(async (to, from) => {
    const mainStore = useMainStore();
    const paramsLocale = mainStore.language || "en";
    if (!SUPPORT_LOCALES.includes(paramsLocale)) {
      return `/${locale}${to.fullPath}`;
    }
    if (!i18n2.global.availableLocales.includes(paramsLocale)) {
      await loadLocaleMessages(paramsLocale);
    }
    setI18nLanguage(paramsLocale);
    return true;
  });
  return router;
}
const inBrowser = typeof window !== "undefined" && window !== null;
const hasIntersectionObserver = checkIntersectionObserver();
function checkIntersectionObserver() {
  if (inBrowser && "IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype) {
    if (!("isIntersecting" in window.IntersectionObserverEntry.prototype)) {
      Object.defineProperty(window.IntersectionObserverEntry.prototype, "isIntersecting", {
        get: function() {
          return this.intersectionRatio > 0;
        }
      });
    }
    return true;
  }
  return false;
}
const modeType = {
  event: "event",
  observer: "observer"
};
function remove(arr, item) {
  if (!arr.length)
    return;
  const index2 = arr.indexOf(item);
  if (index2 > -1)
    return arr.splice(index2, 1);
  return void 0;
}
function getBestSelectionFromSrcset(el, scale) {
  if (el.tagName !== "IMG" || !el.getAttribute("data-srcset"))
    return "";
  const options = el.getAttribute("data-srcset").trim().split(",");
  const result = [];
  const container = el.parentNode;
  const containerWidth = container.offsetWidth * scale;
  let spaceIndex;
  let tmpSrc;
  let tmpWidth;
  options.forEach((item) => {
    item = item.trim();
    spaceIndex = item.lastIndexOf(" ");
    if (spaceIndex === -1) {
      tmpSrc = item;
      tmpWidth = 99999;
    } else {
      tmpSrc = item.substr(0, spaceIndex);
      tmpWidth = parseInt(item.substr(spaceIndex + 1, item.length - spaceIndex - 2), 10);
    }
    result.push([tmpWidth, tmpSrc]);
  });
  result.sort((a, b) => {
    if (a[0] < b[0]) {
      return 1;
    }
    if (a[0] > b[0]) {
      return -1;
    }
    if (a[0] === b[0]) {
      if (b[1].indexOf(".webp", b[1].length - 5) !== -1) {
        return 1;
      }
      if (a[1].indexOf(".webp", a[1].length - 5) !== -1) {
        return -1;
      }
    }
    return 0;
  });
  let bestSelectedSrc = "";
  let tmpOption;
  for (let i = 0; i < result.length; i++) {
    tmpOption = result[i];
    bestSelectedSrc = tmpOption[1];
    const next = result[i + 1];
    if (next && next[0] < containerWidth) {
      bestSelectedSrc = tmpOption[1];
      break;
    } else if (!next) {
      bestSelectedSrc = tmpOption[1];
      break;
    }
  }
  return bestSelectedSrc;
}
const getDPR = (scale = 1) => inBrowser ? window.devicePixelRatio || scale : scale;
function throttle(action, delay) {
  let timeout = null;
  let lastRun = 0;
  return function(...args) {
    if (timeout) {
      return;
    }
    const elapsed = Date.now() - lastRun;
    const context = this;
    const runCallback = function() {
      lastRun = Date.now();
      timeout = false;
      action.apply(context, args);
    };
    if (elapsed >= delay) {
      runCallback();
    } else {
      timeout = setTimeout(runCallback, delay);
    }
  };
}
function testSupportsPassive() {
  if (!inBrowser)
    return false;
  let support = false;
  try {
    const opts = Object.defineProperty({}, "passive", {
      // eslint-disable-next-line getter-return
      get: function() {
        support = true;
      }
    });
    window.addEventListener("test", noop, opts);
  } catch (e) {
  }
  return support;
}
const supportsPassive = testSupportsPassive();
const _ = {
  on(el, type, func, capture = false) {
    if (supportsPassive) {
      el.addEventListener(type, func, {
        capture,
        passive: true
      });
    } else {
      el.addEventListener(type, func, capture);
    }
  },
  off(el, type, func, capture = false) {
    el.removeEventListener(type, func, capture);
  }
};
const loadImageAsync = (item, resolve2, reject) => {
  let image = new Image();
  if (!item || !item.src) {
    const err = new Error("image src is required");
    return reject(err);
  }
  if (item.cors) {
    image.crossOrigin = item.cors;
  }
  image.src = item.src;
  image.onload = function() {
    resolve2({
      naturalHeight: image.naturalHeight,
      naturalWidth: image.naturalWidth,
      src: image.src
    });
    image = null;
  };
  image.onerror = function(e) {
    reject(e);
  };
};
const style = (el, prop) => {
  return typeof getComputedStyle !== "undefined" ? getComputedStyle(el, null).getPropertyValue(prop) : el.style[prop];
};
const overflow = (el) => {
  return style(el, "overflow") + style(el, "overflowY") + style(el, "overflowX");
};
const scrollParent = (el) => {
  if (!inBrowser)
    return;
  if (!(el instanceof Element)) {
    return window;
  }
  let parent = el;
  while (parent) {
    if (parent === document.body || parent === document.documentElement) {
      break;
    }
    if (!parent.parentNode) {
      break;
    }
    if (/(scroll|auto)/.test(overflow(parent))) {
      return parent;
    }
    parent = parent.parentNode;
  }
  return window;
};
function noop() {
}
class ImageCache {
  constructor(max) {
    __publicField(this, "max");
    __publicField(this, "_caches");
    this.max = max || 100;
    this._caches = [];
  }
  has(key) {
    return this._caches.indexOf(key) > -1;
  }
  add(key) {
    if (this.has(key))
      return;
    this._caches.push(key);
    if (this._caches.length > this.max) {
      this.free();
    }
  }
  free() {
    this._caches.shift();
  }
}
class ReactiveListener {
  constructor(el, src, error, loading, bindType, $parent, options, cors, elRenderer, imageCache) {
    __publicField(this, "el");
    __publicField(this, "src");
    __publicField(this, "error");
    __publicField(this, "loading");
    __publicField(this, "bindType");
    __publicField(this, "$parent");
    __publicField(this, "options");
    __publicField(this, "cors");
    __publicField(this, "elRenderer");
    __publicField(this, "attempt");
    __publicField(this, "naturalHeight");
    __publicField(this, "naturalWidth");
    __publicField(this, "performanceData");
    __publicField(this, "state");
    __publicField(this, "rect");
    __publicField(this, "_imageCache");
    this.el = el;
    this.src = src;
    this.error = error;
    this.loading = loading;
    this.bindType = bindType;
    this.attempt = 0;
    this.cors = cors;
    this.naturalHeight = 0;
    this.naturalWidth = 0;
    this.options = options;
    this.rect = {};
    this.$parent = $parent;
    this.elRenderer = elRenderer;
    this._imageCache = imageCache;
    this.performanceData = {
      init: Date.now(),
      loadStart: 0,
      loadEnd: 0
    };
    this.filter();
    this.initState();
    this.render("loading", false);
  }
  /*
   * init listener state
   * @return
   */
  initState() {
    if ("dataset" in this.el) {
      this.el.dataset.src = this.src;
    } else {
      this.el.setAttribute("data-src", this.src);
    }
    this.state = {
      loading: false,
      error: false,
      loaded: false,
      rendered: false
    };
  }
  /*
   * record performance
   * @return
   */
  record(event) {
    this.performanceData[event] = Date.now();
  }
  /*
   * update image listener data
   * @param  {String} image uri
   * @param  {String} loading image uri
   * @param  {String} error image uri
   * @return
   */
  update(option) {
    const oldSrc = this.src;
    this.src = option.src;
    this.loading = option.loading;
    this.error = option.error;
    this.filter();
    if (oldSrc !== this.src) {
      this.attempt = 0;
      this.initState();
    }
  }
  /*
   * get el node rect
   * @return
   */
  getRect() {
    this.rect = this.el.getBoundingClientRect();
  }
  /*
   * check el is in view
   * @return {Boolean} el is in view
   */
  checkInView() {
    this.getRect();
    return this.rect.top < window.innerHeight * this.options.preLoad && this.rect.bottom > this.options.preLoadTop && this.rect.left < window.innerWidth * this.options.preLoad && this.rect.right > 0;
  }
  /*
   * listener filter
   */
  filter() {
    for (const key in this.options.filter) {
      this.options.filter[key](this, this.options);
    }
  }
  /*
   * render loading first
   * @params cb:Function
   * @return
   */
  renderLoading(cb) {
    this.state.loading = true;
    loadImageAsync(
      {
        src: this.loading,
        cors: this.cors
      },
      () => {
        this.render("loading", false);
        this.state.loading = false;
        cb();
      },
      () => {
        cb();
        this.state.loading = false;
        if (!this.options.silent)
          console.warn(`VueLazyload log: load failed with loading image(${this.loading})`);
      }
    );
  }
  /*
   * try load image and  render it
   * @return
   */
  load(onFinish = noop) {
    if (this.attempt > this.options.attempt - 1 && this.state.error) {
      if (!this.options.silent)
        console.log(`VueLazyload log: ${this.src} tried too more than ${this.options.attempt} times`);
      onFinish();
      return;
    }
    if (this.state.rendered && this.state.loaded)
      return;
    if (this._imageCache.has(this.src)) {
      this.state.loaded = true;
      this.render("loaded", true);
      this.state.rendered = true;
      return onFinish();
    }
    this.renderLoading(() => {
      this.attempt++;
      this.options.adapter.beforeLoad && this.options.adapter.beforeLoad(this, this.options);
      this.record("loadStart");
      loadImageAsync(
        {
          src: this.src,
          cors: this.cors
        },
        (data) => {
          this.naturalHeight = data.naturalHeight;
          this.naturalWidth = data.naturalWidth;
          this.state.loaded = true;
          this.state.error = false;
          this.record("loadEnd");
          this.render("loaded", false);
          this.state.rendered = true;
          this._imageCache.add(this.src);
          onFinish();
        },
        (err) => {
          !this.options.silent && console.error(err);
          this.state.error = true;
          this.state.loaded = false;
          this.render("error", false);
        }
      );
    });
  }
  /*
   * render image
   * @param  {String} state to render // ['loading', 'src', 'error']
   * @param  {String} is form cache
   * @return
   */
  render(state, cache) {
    this.elRenderer(this, state, cache);
  }
  /*
   * output performance data
   * @return {Object} performance data
   */
  performance() {
    let state = "loading";
    let time = 0;
    if (this.state.loaded) {
      state = "loaded";
      time = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1e3;
    }
    if (this.state.error)
      state = "error";
    return {
      src: this.src,
      state,
      time
    };
  }
  /*
   * $destroy
   * @return
   */
  $destroy() {
    this.el = null;
    this.src = "";
    this.error = null;
    this.loading = "";
    this.bindType = null;
    this.attempt = 0;
  }
}
const DEFAULT_URL = "";
const DEFAULT_EVENTS = ["scroll", "wheel", "mousewheel", "resize", "animationend", "transitionend", "touchmove"];
const DEFAULT_OBSERVER_OPTIONS = {
  rootMargin: "0px",
  threshold: 0
};
class Lazy {
  constructor({
    preLoad,
    error,
    throttleWait,
    preLoadTop,
    dispatchEvent,
    loading,
    attempt,
    silent = true,
    scale,
    listenEvents,
    filter,
    adapter,
    observer,
    observerOptions
  }) {
    __publicField(this, "version");
    __publicField(this, "mode");
    __publicField(this, "ListenerQueue");
    __publicField(this, "TargetIndex");
    __publicField(this, "TargetQueue");
    __publicField(this, "options");
    __publicField(this, "lazyLoadHandler");
    __publicField(this, "_imageCache");
    __publicField(this, "_observer");
    __publicField(this, "lazyContainerMananger");
    __publicField(this, "Event");
    __publicField(this, "$on");
    __publicField(this, "$once");
    __publicField(this, "$off");
    __publicField(this, "$emit");
    this.version = "__VUE_LAZYLOAD_VERSION__";
    this.lazyContainerMananger = null;
    this.mode = modeType.event;
    this.ListenerQueue = [];
    this.TargetIndex = 0;
    this.TargetQueue = [];
    this.options = {
      silent,
      dispatchEvent: !!dispatchEvent,
      throttleWait: throttleWait || 200,
      preLoad: preLoad || 1.3,
      preLoadTop: preLoadTop || 0,
      error: error || DEFAULT_URL,
      loading: loading || DEFAULT_URL,
      attempt: attempt || 3,
      scale: scale || getDPR(scale),
      listenEvents: listenEvents || DEFAULT_EVENTS,
      supportWebp: supportWebp(),
      filter: filter || {},
      adapter: adapter || {},
      observer: !!observer,
      observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
    };
    this._initEvent();
    this._imageCache = new ImageCache(200);
    this.lazyLoadHandler = throttle(this._lazyLoadHandler.bind(this), this.options.throttleWait);
    this.setMode(this.options.observer ? modeType.observer : modeType.event);
  }
  /**
   * output listener's load performance
   * @return {Array}
   */
  performance() {
    const list = [];
    this.ListenerQueue.map((item) => list.push(item.performance()));
    return list;
  }
  /*
   * add lazy component to queue
   * @param  {Vue} vm lazy component instance
   * @return
   */
  addLazyBox(vm) {
    this.ListenerQueue.push(vm);
    if (inBrowser) {
      this._addListenerTarget(window);
      this._observer && this._observer.observe(vm.el);
      if (vm.$el && vm.$el.parentNode) {
        this._addListenerTarget(vm.$el.parentNode);
      }
    }
  }
  /*
   * add image listener to queue
   * @param  {DOM} el
   * @param  {object} binding vue directive binding
   * @param  {vnode} vnode vue directive vnode
   * @return
   */
  add(el, binding, vnode) {
    if (this.ListenerQueue.some((item) => item.el === el)) {
      this.update(el, binding);
      return nextTick(this.lazyLoadHandler);
    }
    let { src, loading, error, cors } = this._valueFormatter(binding.value);
    nextTick(() => {
      src = getBestSelectionFromSrcset(el, this.options.scale) || src;
      this._observer && this._observer.observe(el);
      const container = Object.keys(binding.modifiers)[0];
      let $parent;
      if (container) {
        $parent = binding.instance.$refs[container];
        $parent = $parent ? $parent.el || $parent : document.getElementById(container);
      }
      if (!$parent) {
        $parent = scrollParent(el);
      }
      const newListener = new ReactiveListener(
        el,
        src,
        error,
        loading,
        binding.arg,
        $parent,
        this.options,
        cors,
        this._elRenderer.bind(this),
        this._imageCache
      );
      this.ListenerQueue.push(newListener);
      if (inBrowser) {
        this._addListenerTarget(window);
        this._addListenerTarget($parent);
      }
      nextTick(this.lazyLoadHandler);
    });
    return void 0;
  }
  /**
   * update image src
   * @param  {DOM} el
   * @param  {object} vue directive binding
   * @return
   */
  update(el, binding, vnode) {
    let { src, loading, error } = this._valueFormatter(binding.value);
    src = getBestSelectionFromSrcset(el, this.options.scale) || src;
    const exist = this.ListenerQueue.find((item) => item.el === el);
    if (!exist) {
      if (el.getAttribute("lazy") !== "loaded" || el.dataset.src !== src) {
        this.add(el, binding, vnode);
      }
    } else {
      exist.update({
        src,
        loading,
        error
      });
    }
    if (this._observer) {
      this._observer.unobserve(el);
      this._observer.observe(el);
    }
    nextTick(this.lazyLoadHandler);
  }
  /**
   * remove listener form list
   * @param  {DOM} el
   * @return
   */
  remove(el) {
    if (!el)
      return;
    this._observer && this._observer.unobserve(el);
    const existItem = this.ListenerQueue.find((item) => item.el === el);
    if (existItem) {
      this._removeListenerTarget(existItem.$parent);
      this._removeListenerTarget(window);
      remove(this.ListenerQueue, existItem);
      existItem.$destroy && existItem.$destroy();
    }
  }
  /*
   * remove lazy components form list
   * @param  {Vue} vm Vue instance
   * @return
   */
  removeComponent(vm) {
    if (!vm)
      return;
    remove(this.ListenerQueue, vm);
    this._observer && this._observer.unobserve(vm.el);
    if (vm.$parent && vm.$el.parentNode) {
      this._removeListenerTarget(vm.$el.parentNode);
    }
    this._removeListenerTarget(window);
  }
  setMode(mode) {
    if (!hasIntersectionObserver && mode === modeType.observer) {
      mode = modeType.event;
    }
    this.mode = mode;
    if (mode === modeType.event) {
      if (this._observer) {
        this.ListenerQueue.forEach((listener) => {
          this._observer.unobserve(listener.el);
        });
        this._observer = null;
      }
      this.TargetQueue.forEach((target) => {
        this._initListen(target.el, true);
      });
    } else {
      this.TargetQueue.forEach((target) => {
        this._initListen(target.el, false);
      });
      this._initIntersectionObserver();
    }
  }
  /*
   *** Private functions ***
   */
  /*
   * add listener target
   * @param  {DOM} el listener target
   * @return
   */
  _addListenerTarget(el) {
    if (!el)
      return;
    let target = this.TargetQueue.find((target2) => target2.el === el);
    if (!target) {
      target = {
        el,
        id: ++this.TargetIndex,
        childrenCount: 1,
        listened: true
      };
      this.mode === modeType.event && this._initListen(target.el, true);
      this.TargetQueue.push(target);
    } else {
      target.childrenCount++;
    }
    return this.TargetIndex;
  }
  /*
   * remove listener target or reduce target childrenCount
   * @param  {DOM} el or window
   * @return
   */
  _removeListenerTarget(el) {
    this.TargetQueue.forEach((target, index2) => {
      if (target.el === el) {
        target.childrenCount--;
        if (!target.childrenCount) {
          this._initListen(target.el, false);
          this.TargetQueue.splice(index2, 1);
          target = null;
        }
      }
    });
  }
  /*
   * add or remove eventlistener
   * @param  {DOM} el DOM or Window
   * @param  {boolean} start flag
   * @return
   */
  _initListen(el, start) {
    this.options.listenEvents.forEach((evt) => _[start ? "on" : "off"](el, evt, this.lazyLoadHandler));
  }
  _initEvent() {
    this.Event = {
      listeners: {
        loading: [],
        loaded: [],
        error: []
      }
    };
    this.$on = (event, func) => {
      if (!this.Event.listeners[event])
        this.Event.listeners[event] = [];
      this.Event.listeners[event].push(func);
    };
    this.$once = (event, func) => {
      const vm = this;
      function on(...args) {
        vm.$off(event, on);
        func.apply(vm, args);
      }
      this.$on(event, on);
    };
    this.$off = (event, func) => {
      if (!func) {
        if (!this.Event.listeners[event])
          return;
        this.Event.listeners[event].length = 0;
        return;
      }
      remove(this.Event.listeners[event], func);
    };
    this.$emit = (event, context, inCache) => {
      if (!this.Event.listeners[event])
        return;
      this.Event.listeners[event].forEach((func) => func(context, inCache));
    };
  }
  /**
   * find nodes which in viewport and trigger load
   * @return
   */
  _lazyLoadHandler() {
    const freeList = [];
    this.ListenerQueue.forEach((listener, index2) => {
      if (!listener.el || !listener.el.parentNode || listener.state.loaded) {
        freeList.push(listener);
      }
      const catIn = listener.checkInView();
      if (!catIn)
        return;
      if (!listener.state.loaded)
        listener.load();
    });
    freeList.forEach((item) => {
      remove(this.ListenerQueue, item);
      item.$destroy && item.$destroy();
    });
  }
  /**
   * init IntersectionObserver
   * set mode to observer
   * @return
   */
  _initIntersectionObserver() {
    if (!hasIntersectionObserver)
      return;
    this._observer = new IntersectionObserver(this._observerHandler.bind(this), this.options.observerOptions);
    if (this.ListenerQueue.length) {
      this.ListenerQueue.forEach((listener) => {
        this._observer.observe(listener.el);
      });
    }
  }
  /**
   * init IntersectionObserver
   * @param {Array<IntersectionObserverEntry>} entries
   * @return
   */
  _observerHandler(entries) {
    entries.forEach((entry) => {
      if (entry.isIntersecting) {
        this.ListenerQueue.forEach((listener) => {
          if (listener.el === entry.target) {
            if (listener.state.loaded)
              return this._observer.unobserve(listener.el);
            listener.load();
          }
        });
      }
    });
  }
  /**
   * set element attribute with image'url and state
   * @param  {ReactiveListener} lazyload listener object
   * @param  {TeventType} state will be rendered
   * @param  {bool} inCache  is rendered from cache
   * @return
   */
  _elRenderer(listener, state, cache) {
    if (!listener.el)
      return;
    const { el, bindType } = listener;
    let src;
    switch (state) {
      case "loading":
        src = listener.loading;
        break;
      case "error":
        src = listener.error;
        break;
      default:
        src = listener.src;
        break;
    }
    if (bindType) {
      el.style[bindType] = 'url("' + src + '")';
    } else if (el.getAttribute("src") !== src) {
      el.setAttribute("src", src);
    }
    el.setAttribute("lazy", state);
    this.$emit(state, listener, cache);
    this.options.adapter[state] && this.options.adapter[state](listener, this.options);
    if (this.options.dispatchEvent) {
      const event = new CustomEvent(state, {
        detail: listener
      });
      el.dispatchEvent(event);
    }
  }
  _valueFormatter(value) {
    if (typeof value === "object") {
      if (!value.src && !this.options.silent)
        console.error("Vue Lazyload warning: miss src with " + value);
      return {
        src: value.src,
        loading: value.loading || this.options.loading,
        error: value.error || this.options.error,
        cors: this.options.cors
      };
    }
    return {
      src: value,
      loading: this.options.loading,
      error: this.options.error,
      cors: this.options.cors
    };
  }
}
const useCheckInView = (el, preLoad) => {
  let rect = reactive({});
  const getRect = () => {
    rect = el.value.getBoundingClientRect();
  };
  const checkInView = () => {
    getRect();
    return inBrowser && rect.top < window.innerHeight * preLoad && rect.bottom > 0 && rect.left < window.innerWidth * preLoad && rect.right > 0;
  };
  return {
    rect,
    checkInView
  };
};
const LazyComponent = (lazy) => {
  return defineComponent({
    props: {
      tag: {
        type: String,
        default: "div"
      }
    },
    emits: ["show"],
    setup(props, { emit, slots }) {
      const el = ref();
      const state = reactive({
        loaded: false,
        error: false,
        attempt: 0
      });
      const show = ref(false);
      const { rect, checkInView } = useCheckInView(el, lazy.options.preLoad);
      const load = () => {
        show.value = true;
        state.loaded = true;
        emit("show", show.value);
      };
      const vm = computed(() => {
        return {
          el: el.value,
          rect,
          checkInView,
          load,
          state
        };
      });
      onMounted(() => {
        lazy.addLazyBox(vm.value);
        lazy.lazyLoadHandler();
      });
      onUnmounted(() => {
        lazy.removeComponent(vm.value);
      });
      return () => {
        var _a;
        return createVNode(
          props.tag,
          {
            ref: el
          },
          [show.value && ((_a = slots.default) == null ? void 0 : _a.call(slots))]
        );
      };
    }
  });
};
const isEnumerable = Object.prototype.propertyIsEnumerable;
const getSymbols = Object.getOwnPropertySymbols;
const assignSymbols = (target, ...args) => {
  if (!isObject(target)) {
    throw new TypeError("expected the first argument to be an object");
  }
  if (args.length === 0 || typeof Symbol !== "function" || typeof getSymbols !== "function") {
    return target;
  }
  for (const arg of args) {
    const names = getSymbols(arg);
    for (const key of names) {
      if (isEnumerable.call(arg, key)) {
        target[key] = arg[key];
      }
    }
  }
  return target;
};
const isValidKey = (key) => {
  return key !== "__proto__" && key !== "constructor" && key !== "prototype";
};
const assignDeep = (target, ...args) => {
  let i = 0;
  if (isPrimitive(target))
    target = args[i++];
  if (!target)
    target = {};
  for (; i < args.length; i++) {
    if (isObject(args[i])) {
      for (const key of Object.keys(args[i])) {
        if (isValidKey(key)) {
          if (isObject(target[key]) && isObject(args[i][key])) {
            assignDeep(target[key], args[i][key]);
          } else {
            target[key] = args[i][key];
          }
        }
      }
      assignSymbols(target, args[i]);
    }
  }
  return target;
};
function isObject(val) {
  return typeof val === "function" || Object.prototype.toString.call(val) === "[object Object]";
}
function isPrimitive(val) {
  return typeof val === "object" ? val === null : typeof val !== "function";
}
class LazyContainerMananger {
  constructor(lazy) {
    __publicField(this, "lazy");
    __publicField(this, "_queue");
    this.lazy = lazy;
    lazy.lazyContainerMananger = this;
    this._queue = [];
  }
  bind(el, binding, vnode) {
    const container = new LazyContainer(el, binding, vnode, this.lazy);
    this._queue.push(container);
  }
  update(el, binding, vnode) {
    const container = this._queue.find((item) => item.el === el);
    if (!container)
      return;
    container.update(el, binding);
  }
  unbind(el, binding, vnode) {
    const container = this._queue.find((item) => item.el === el);
    if (!container)
      return;
    container.clear();
    remove(this._queue, container);
  }
}
const defaultOptions = {
  selector: "img",
  error: "",
  loading: ""
};
class LazyContainer {
  constructor(el, binding, vnode, lazy) {
    __publicField(this, "el");
    __publicField(this, "_queue");
    __publicField(this, "options");
    __publicField(this, "lazy");
    __publicField(this, "binding");
    __publicField(this, "vnode");
    this.el = el;
    this.vnode = vnode;
    this.binding = binding;
    this.options = {};
    this.lazy = lazy;
    this._queue = [];
    this.update(el, binding);
  }
  update(el, binding) {
    this.el = el;
    this.options = assignDeep({}, defaultOptions, binding.value);
    const imgs = this.getImgs();
    imgs.forEach((el2) => {
      this.lazy.add(
        el2,
        assignDeep({}, this.binding, {
          value: {
            src: el2.getAttribute("data-src") || el2.dataset.src,
            error: el2.getAttribute("data-error") || el2.dataset.error || this.options.error,
            loading: el2.getAttribute("data-loading") || el2.dataset.loading || this.options.loading
          }
        }),
        this.vnode
      );
    });
  }
  getImgs() {
    return Array.from(this.el.querySelectorAll(this.options.selector));
  }
  clear() {
    const imgs = this.getImgs();
    imgs.forEach((el) => this.lazy.remove(el));
    this.vnode = null;
    this.binding = null;
    this.lazy = null;
  }
}
const LazyImage = (lazy) => {
  return defineComponent({
    setup(props, { slots }) {
      const el = ref();
      const options = reactive({
        src: "",
        error: "",
        loading: "",
        attempt: lazy.options.attempt
      });
      const state = reactive({
        loaded: false,
        error: false,
        attempt: 0
      });
      const { rect, checkInView } = useCheckInView(el, lazy.options.preLoad);
      const renderSrc = ref("");
      const load = (onFinish = noop) => {
        if (state.attempt > options.attempt - 1 && state.error) {
          if (!lazy.options.silent)
            console.log(`VueLazyload log: ${options.src} tried too more than ${options.attempt} times`);
          return onFinish();
        }
        const src = options.src;
        loadImageAsync(
          { src },
          ({ src: src2 }) => {
            renderSrc.value = src2;
            state.loaded = true;
          },
          () => {
            state.attempt++;
            renderSrc.value = options.error;
            state.error = true;
          }
        );
      };
      const vm = computed(() => {
        return {
          el: el.value,
          rect,
          checkInView,
          load,
          state
        };
      });
      onMounted(() => {
        lazy.addLazyBox(vm.value);
        lazy.lazyLoadHandler();
      });
      onUnmounted(() => {
        lazy.removeComponent(vm.value);
      });
      const init = () => {
        const { src, loading, error } = lazy._valueFormatter(props.src);
        state.loaded = false;
        options.src = src;
        options.error = error;
        options.loading = loading;
        renderSrc.value = options.loading;
      };
      watch(
        () => props.src,
        () => {
          init();
          lazy.addLazyBox(vm.value);
          lazy.lazyLoadHandler();
        },
        {
          immediate: true
        }
      );
      return () => {
        var _a;
        return createVNode(
          props.tag || "img",
          {
            src: renderSrc.value,
            ref: el
          },
          [(_a = slots.default) == null ? void 0 : _a.call(slots)]
        );
      };
    }
  });
};
const Lazyload = {
  /*
   * install function
   * @param  {Vue} Vue
   * @param  {object} options lazyload options
   */
  install(Vue, options = {}) {
    const lazy = new Lazy(options);
    const lazyContainer = new LazyContainerMananger(lazy);
    const vueVersion = Number(Vue.version.split(".")[0]);
    if (vueVersion < 3)
      return new Error("Vue version at least 3.0");
    Vue.config.globalProperties.$Lazyload = lazy;
    Vue.provide("Lazyload", lazy);
    if (options.lazyComponent) {
      Vue.component("LazyComponent", LazyComponent(lazy));
    }
    if (options.lazyImage) {
      Vue.component("LazyImage", LazyImage(lazy));
    }
    Vue.directive("lazy", {
      beforeMount: lazy.add.bind(lazy),
      beforeUpdate: lazy.update.bind(lazy),
      updated: lazy.lazyLoadHandler.bind(lazy),
      unmounted: lazy.remove.bind(lazy)
    });
    Vue.directive("lazy-container", {
      beforeMount: lazyContainer.bind.bind(lazyContainer),
      updated: lazyContainer.update.bind(lazyContainer),
      unmounted: lazyContainer.unbind.bind(lazyContainer)
    });
  }
};
const errorLogo = "";
const lazyImageFilter = {
  lazyComponent: true,
  lazyImage: true,
  preLoad: 1.7,
  dispatchEvent: true,
  filter: {
    cdn(listener, options) {
      var _a;
      const size = ((_a = listener.el.attributes.getNamedItem("thumbnail-size")) == null ? void 0 : _a.value) || void 0;
      listener.src = cdnUrl({
        url: listener.src,
        size,
        isSupportWebp: options.supportWebp
      });
    }
    // static(listener, options) {
    //   const hostTest = /https?:\/\/([^\/]*)/
    //   const isHostUrl = hostTest.test(listener.src)
    //   if (!isHostUrl) {
    //     listener.src = new URL(listener.src, import.meta.url).href
    //   }
    // }
  },
  adapter: {
    loaded({ el }) {
      el.style.backgroundColor = "";
      if (el.__patpatBgLoading__) {
        el.style.opacity = 0.4;
        poll(el, 0.4);
      }
    },
    loading(listender) {
      if (!listender.el.__patpatBgLoading__ && listender.el.getAttribute("lazymode") === "bg" && listender.el.complete) {
        listender.el.__patpatBgLoading__ = true;
        listender.el.style.background = getColor();
      }
    },
    error(listender, Init) {
      if (listender.el) {
        listender.el.classList.add("lazy-load-error", "lazy-load-bg");
        listender.el.style.cssText += `
          background-image: url(${errorLogo});
          background-repeat: no-repeat;
          background-color: #f6f6f6;
          background-position: center;
          background-size: min(40px, 80%);
        `;
        listender.el.setAttribute("src", "");
      }
    }
  }
};
const poll = function(el, opacity) {
  if (window) {
    requestAnimationFrame(() => {
      let nextOpacity = opacity + 0.03;
      nextOpacity = nextOpacity >= 1 ? 1 : nextOpacity;
      el.style.opacity = nextOpacity;
      if (nextOpacity < 1) {
        poll(el, nextOpacity);
      }
    });
  } else {
    el.style.opacity = 1;
  }
};
const bgColorList = ["#CFF9EC", "#C7F7F3", "#D1ECFC", "#FFEDB9", "#FFE3E8", "#FFD9B6"];
let pointer = 0;
const getColor = () => {
  if (pointer >= bgColorList.length) {
    pointer = 0;
  }
  return bgColorList[pointer++];
};
const en = {
  "login": {},
  "common": {
    "footer": {
      "trustpilot_comment_title": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["They all love PatPat"]);
      }
    },
    "activity": {
      "ok": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["OK"]);
      },
      "oops": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Oops..."]);
      }
    },
    "time": {
      "days": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["days"]);
      }
    },
    "submit": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Submit"]);
    },
    "cancel": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Cancel"]);
    },
    "faq": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["FAQs"]);
    },
    "mate_title": (ctx) => {
      const { normalize: _normalize, plural: _plural } = ctx;
      return _plural([_normalize(["Daily Deals For Moms"]), _normalize(["PatPat"])]);
    },
    "mate_keywords": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["baby clothes sale, toddler clothing stores, kids fashion, family matching clothes, patpat online store, online shopping"]);
    },
    "mate_description": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Patpat.com offers daily deals for moms, you can buy high quality newborn baby clothes and kids clothing, or shop latest women fashion costume, we also offer family matching outfits and home accessories!"]);
    },
    "faq_support": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["FAQs & Support"]);
    },
    "confirm": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Confirm"]);
    }
  },
  "product": {
    "category": {
      "no_results": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["No Match Results"]);
      },
      "price_from": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["From"]);
      },
      "color_tip": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Please select Color"]);
      },
      "group_tip": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Please select a family member"]);
      },
      "size_tip": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Please select size"]);
      },
      "size": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Size"]);
      }
    },
    "shipping": {
      "shopping_method": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["SHIPPING METHOD"]);
      },
      "economic_delivery": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["ECONOMIC DELIVERY(Pick up by yourself)"]);
      },
      "shipping_rates_text": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["The shipping costs shown below only apply to the selected country."]);
      },
      "Tracking_my_order": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Tracking my order"]);
      },
      "area_outside": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Some territories, such as Puerto Rico, Guam, Alaska, Hawaii, etc are outside the delivery area."]);
      },
      "new_descriptor": (ctx) => {
        const { normalize: _normalize, interpolate: _interpolate, list: _list } = ctx;
        return _normalize(["You can track your order through the ", _interpolate(_list(0)), " section in your account or ", _interpolate(_list(1)), ". Please note that the shipping time doesn't inclide 1-2 processing days."]);
      },
      "my_Order": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(['"My Order" ']);
      },
      "order_status": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(['"Order Status"']);
      }
    },
    "detail": {
      "Free_Shipping_On_New_Orders": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Free Shipping For New Users! "]);
      },
      "Free_Shipping_On_All_Orders": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Free Shipping On All Orders"]);
      },
      "product_details_mate_title": (ctx) => {
        const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
        return _normalize([_interpolate(_named("name")), " Only ", _interpolate(_named("price")), " ", _interpolate(_named("tdk")), " Mobile"]);
      },
      "details": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Details"]);
      },
      "family_member": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Family member"]);
      },
      "size_chart": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Size chart"]);
      },
      "lastStock": (ctx) => {
        const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
        return _normalize(["Only ", _interpolate(_named("stock")), " left"]);
      },
      "product_is_out_of_stock": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Sorry, this product is out of stock."]);
      }
    },
    "specialOffer": {},
    "color": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Color"]);
    },
    "size_body": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Body measurements"]);
    }
  },
  "public": {
    "client": {},
    "common": {}
  },
  "activity": {},
  "banner": {
    "install": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["GET"]);
    }
  },
  "w2a": {
    "banner": {
      "desc": (ctx) => {
        const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
        return _normalize(["Save up to ", _interpolate(_named("discount")), " off with the PatPat App!"]);
      },
      "desc_ar": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Get One Free Item with Your First In-App Purchase!"]);
      },
      "title": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["PatPat APP - CUTE, QUALITY, GREAT PRICE"]);
      },
      "open_in_app": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Open In App"]);
      }
    },
    "popup": {
      "with_the_app": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["with the PatPat App"]);
      },
      "save_up_to_off": (ctx) => {
        const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
        return _normalize(["Save up to ", _interpolate(_named("discount")), " off "]);
      },
      "free_shipping": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Free Shipping"]);
      },
      "on_the_first": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["on the First In-App Purchase over R$88"]);
      },
      "no_code_need": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["*No code needed"]);
      },
      "get_the_app": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Get The App"]);
      },
      "get_a_free_item": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Get a Free Item"]);
      },
      "when_you_order_through_the_app": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["When You Order Through the PatPat App"]);
      },
      "get_extra_off": (ctx) => {
        const { normalize: _normalize, interpolate: _interpolate, list: _list } = ctx;
        return _normalize(["Get Extra ", _interpolate(_list(0)), " OFF"]);
      },
      "terms_apply": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Terms Apply*"]);
      },
      "code": (ctx) => {
        const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
        return _normalize(["CODE: ", _interpolate(_named("code"))]);
      }
    }
  },
  "account": {
    "common": {
      "country": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Country"]);
      }
    },
    "help": {
      "Slow_reply": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Slow reply"]);
      },
      "Fast_return_refund": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Fast return/refund"]);
      },
      "Fast_response": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Fast response"]);
      },
      "Very_professional": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Very professional"]);
      },
      "Leave_a_comment": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Please leave a comment here"]);
      },
      "How_would_you_rate_this_service": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["How would you rate this service?"]);
      },
      "Please_rate_our_service": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Please rate our service"]);
      },
      "Feel_free_to_contact_us": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Thank you! Feel free to contact us for any further assistance."]);
      },
      "My_Service": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Ticket Records"]);
      },
      "Ended": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["closed"]);
      },
      "In_Progress": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["In Progress"]);
      },
      "Yes": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Yes"]);
      },
      "No": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["No"]);
      },
      "Reply": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Reply"]);
      },
      "Ticket_Details": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Ticket Details"]);
      },
      "question": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Search Your Question"]);
      },
      "mark_this_case_as_resolved": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Are you sure you want to mark this case as resolved?"]);
      },
      "Solved": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Solved"]);
      },
      "problm": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Select a problem"]);
      },
      "not_found": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Order Not Found"]);
      },
      "Unprofessional_support": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Unprofessional support"]);
      },
      "Cant_cancel_order": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Can't cancel order"]);
      },
      "Cant_change_address": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Can't change address"]);
      },
      "Long_shipping": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Long shipping"]);
      },
      "Quality_issue": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Quality issue"]);
      },
      "Size_issue": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Size issue"]);
      },
      "Great_attitude": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Great attitude"]);
      },
      "Faster_reply": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Faster reply"]);
      },
      "Language_barriers": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Language barriers"]);
      },
      "Timely_refund": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Timely refund"]);
      },
      "Easy_return_refund": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Easy return/refund"]);
      },
      "Timely_arrival": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Timely arrival"]);
      },
      "Good_quality": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Good quality"]);
      },
      "Accurate_size": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Accurate size"]);
      },
      "Fast_delivery": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Fast delivery"]);
      },
      "Great_quality": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Great quality"]);
      }
    },
    "notification": {
      "empty": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["It's empty here"]);
      }
    }
  },
  "shopping": {
    "cart": {},
    "l_delivery_time": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["DELIVERY TIME"]);
    },
    "costs": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["COSTS"]);
    },
    "morocco_free_for_orders_over": (ctx) => {
      const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
      return _normalize([_interpolate(_named("freight")), " -- For order amount under ", _interpolate(_named("order_amount"))]);
    },
    "morocco_free_for_orders_over_two": (ctx) => {
      const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
      return _normalize([_interpolate(_named("extra_freight")), " -- For order amount over ", _interpolate(_named("order_amount")), ", but under ", _interpolate(_named("exceed_order_amount"))]);
    },
    "morocco_free_for_orders_over_three": (ctx) => {
      const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
      return _normalize([_interpolate(_named("freight")), " -- For order amount over ", _interpolate(_named("order_amount"))]);
    },
    "free_shipping_over": (ctx) => {
      const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
      return _normalize(["Free shipping on orders over ", _interpolate(_named("free_shipping_point"))]);
    },
    "mexico_freight": (ctx) => {
      const { normalize: _normalize, interpolate: _interpolate, named: _named } = ctx;
      return _normalize(["FREE for orders over ", _interpolate(_named("free_shipping_point")), " otherwise ", _interpolate(_named("freight"))]);
    },
    "mexico_extra_freight": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["*An additional shipping charge will be applied when the order exceeds 10 pieces."]);
    },
    "info": {
      "phone": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Phone Number"]);
      }
    }
  },
  "helpCenter": {
    "Customer_Service": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Customer Service"]);
    },
    "24h_online": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["24h online"]);
    },
    "ticket": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Ticket"]);
    },
    "submit_record": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["submit & record"]);
    },
    "submit": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["submit"]);
    },
    "Related_Question": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Related Question"]);
    },
    "Submit_Ticket": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Submit Ticket"]);
    },
    "reply_within_2_days": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["We will reply within 2 business days"]);
    },
    "received_your_ticket": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["We‘ve received your ticket"]);
    },
    "Issue_selected": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Issue selected"]);
    },
    "Please_select_your_issue": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["please select your issue"]);
    },
    "Describe_question": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Describe question"]);
    },
    "describe_question_placeholder": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Please describe your question here"]);
    },
    "Add_picture": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Add picture"]);
    },
    "reply_within_24_to_48_hours": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["We will reply within 24-48 hours"]);
    },
    "liveChat": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Livechat"]);
    },
    "more_question": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Have more questions?Contact us"]);
    },
    "article_helpful": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Was this article helpful?"]);
    },
    "order_total": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Order total"]);
    },
    "orders_items": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Items"]);
    },
    "orders_item": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Item"]);
    },
    "order_date": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Date"]);
    },
    "order_selected": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Order selected"]);
    },
    "items_selected": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Item(s) selected"]);
    }
  },
  "about": {
    "common": {
      "please_enter_a_title": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Please enter a title"]);
      },
      "select_country": (ctx) => {
        const { normalize: _normalize } = ctx;
        return _normalize(["Select a country"]);
      }
    }
  },
  "game_activity": {
    "go_shopping": (ctx) => {
      const { normalize: _normalize } = ctx;
      return _normalize(["Go shopping"]);
    }
  }
};
const track = {
  mounted: function(el, binding, vNode) {
    const { click, exposure } = binding.modifiers;
    if (!click && !exposure && false) {
      console.warn("必须使用 click 或者 exposure");
    }
    const { trackName, pId, pContent, eventName } = binding.value;
    if (click) {
      const trackClickEvent = () => {
        let id = "";
        let content = {};
        let componentEventName = "unknown";
        if (pId && typeof pId === "string") {
          id = pId;
        }
        if (eventName && typeof eventName === "string") {
          componentEventName = eventName;
        }
        if (trackName && typeof trackName === "string") {
          id = trackName;
        }
        if (pContent) {
          if (typeof pContent === "string" && isPlainObject(pContent)) {
            content = JSON.parse(pContent);
          }
          if (typeof pContent === "object") {
            content = pContent;
          }
        }
        if (typeof binding.value === "function") {
          const data = binding.value();
          if (data) {
            if (data.id && typeof data.id === "string") {
              id = data.id;
            }
            if (data.eventName && typeof data.eventName === "string") {
              componentEventName = data.eventName;
            }
            if (data.content) {
              if (typeof data.content === "string" && isPlainObject(data.content)) {
                content = JSON.parse(data.content);
              }
              if (typeof data.content === "object") {
                content = data.content;
              }
            }
          }
        }
        id && appendClickTrackData(id, componentEventName, content);
      };
      el.addEventListener("click", trackClickEvent, {
        capture: true
      });
      el.addEventListener("keydown", (event) => {
        if (event.keyCode === 13 && typeof appendClickTrackData === "function") {
          trackClickEvent();
        }
      });
    }
    if (exposure) {
      const observer = new IntersectionObserver(
        (entries) => {
          entries.forEach((entry) => {
            if (entry.intersectionRatio > 0) {
              el.setAttribute("track", "tracked");
              let id = "";
              let content = {};
              let componentEventName = "unknown";
              if (pId && typeof pId === "string") {
                id = pId;
                if (pContent) {
                  if (typeof pContent === "object") {
                    content = pContent;
                  }
                  if (typeof pContent === "string" && isPlainObject(pContent)) {
                    content = JSON.parse(pContent);
                  }
                }
                if (eventName && typeof eventName === "string") {
                  componentEventName = eventName;
                }
              } else if (typeof binding.value === "function") {
                const data = binding.value();
                if (data) {
                  if (data.id && typeof data.id === "string") {
                    id = data.id;
                  }
                  if (data.eventName && typeof data.eventName === "string") {
                    componentEventName = data.eventName;
                  }
                  if (typeof data.content === "string" && isPlainObject(data.content)) {
                    content = JSON.parse(data.content);
                  }
                  if (typeof data.content === "object") {
                    content = data.content;
                  }
                }
              }
              if (id) {
                appendExposureData(id, componentEventName, content);
              }
              observer.unobserve(el);
              el.patpatExposure = null;
            }
          });
        },
        { threshold: [0.6, 1] }
      );
      observer.observe(el);
      el.patpatExposure = {
        observer
      };
    }
  },
  unmounted(el) {
    const target = el.patpatExposure;
    if (!target) {
      return;
    }
    const { observer } = target;
    if (observer) {
      observer.unobserve(el);
    }
  }
};
const loadingLogo = "";
const index$5 = "";
const [name$5, bem$5] = createNamespace("image");
const imageProps = {
  src: String,
  alt: String,
  fit: String,
  position: String,
  round: Boolean,
  block: Boolean,
  width: numericProp,
  height: numericProp,
  radius: numericProp,
  lazyLoad: Boolean,
  iconSize: numericProp,
  showError: truthProp,
  errorIcon: makeStringProp("photo-fail"),
  iconPrefix: String,
  showLoading: truthProp,
  loadingIcon: makeStringProp("photo"),
  thumbnailSize: String,
  original: Boolean
};
const __default__$7 = defineComponent({
  name: name$5,
  props: imageProps,
  emits: ["load", "error"],
  setup(props, {
    emit,
    slots
  }) {
    const error = ref(false);
    const loading = ref(true);
    const imageRef = ref();
    const {
      $Lazyload
    } = getCurrentInstance().proxy;
    const style2 = computed(() => {
      const style3 = {
        width: addUnit(props.width),
        height: addUnit(props.height)
      };
      if (isDef(props.radius)) {
        style3.overflow = "hidden";
        style3.borderRadius = addUnit(props.radius);
      }
      return style3;
    });
    const cdnSrc = computed(() => {
      const url = cdnUrl({
        url: props.src || "",
        size: props.thumbnailSize,
        type: props.original ? "original" : "",
        isSupportWebp: supportWebp()
      });
      return url;
    });
    watch(() => props.src, () => {
      error.value = false;
      loading.value = true;
    });
    const onLoad = (event) => {
      loading.value = false;
      emit("load", event);
    };
    const onError = (event) => {
      error.value = true;
      loading.value = false;
      emit("error", event);
    };
    const renderIcon = (name2, className, slot) => {
      if (slot) {
        return slot();
      }
      return (
        // <Icon
        //   name={name}
        //   size={props.iconSize}
        //   class={className}
        //   classPrefix={props.iconPrefix}
        // />
        createVNode("div", {
          "class": className
        }, [createVNode("img", {
          "class": className,
          "src": error.value ? errorLogo : loadingLogo,
          "alt": props.alt
        }, null)])
      );
    };
    const renderPlaceholder = () => {
      if (loading.value && props.showLoading) {
        return createVNode("div", {
          "class": bem$5("loading")
        }, [renderIcon(props.loadingIcon, bem$5("loading-icon"), slots.loading)]);
      }
      if (error.value && props.showError) {
        return createVNode("div", {
          "class": bem$5("error")
        }, [renderIcon(props.errorIcon, bem$5("error-icon"), slots.error)]);
      }
      return null;
    };
    const renderImage = () => {
      if (error.value || !props.src) {
        return;
      }
      const attrs = {
        alt: props.alt,
        class: bem$5("img"),
        style: {
          objectFit: props.fit,
          objectPosition: props.position
        }
      };
      if (props.lazyLoad) {
        return withDirectives(createVNode("img", mergeProps({
          "ref": imageRef
        }, attrs), null), [[resolveDirective("lazy"), cdnSrc.value]]);
      }
      nextTick(() => {
        var _a;
        if (!props.lazyLoad && inBrowser$2 && ((_a = imageRef.value) == null ? void 0 : _a.complete) && loading.value) {
          imageRef.value.naturalWidth ? onLoad() : onError();
        }
      });
      return createVNode("img", mergeProps({
        "ref": imageRef,
        "src": cdnSrc.value,
        "onLoad": onLoad,
        "onError": onError
      }, attrs), null);
    };
    const onLazyLoaded = ({
      el
    }) => {
      const check = () => {
        if (el === imageRef.value && loading.value) {
          onLoad();
        }
      };
      if (imageRef.value) {
        check();
      } else {
        nextTick(check);
      }
    };
    const onLazyLoadError = ({
      el
    }) => {
      if (el === imageRef.value && !error.value) {
        onError();
      }
    };
    if ($Lazyload && inBrowser$2) {
      $Lazyload.$on("loaded", onLazyLoaded);
      $Lazyload.$on("error", onLazyLoadError);
      onBeforeUnmount(() => {
        $Lazyload.$off("loaded", onLazyLoaded);
        $Lazyload.$off("error", onLazyLoadError);
      });
    }
    return () => {
      var _a;
      return createVNode("div", {
        "class": bem$5({
          round: props.round,
          block: props.block
        }),
        "style": style2.value
      }, [renderImage(), renderPlaceholder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
    };
  }
});
const __moduleId$7 = "src/components/global/image/Image.tsx";
ssrRegisterHelper(__default__$7, __moduleId$7);
const Image$1 = withInstall(__default__$7);
const index$4 = "";
const [name$4, bem$4] = createNamespace("button");
const buttonProps = extend$1({}, routeProps, {
  tag: makeStringProp("button"),
  text: String,
  icon: String,
  type: makeStringProp("default"),
  size: makeStringProp("normal"),
  color: String,
  block: Boolean,
  plain: Boolean,
  round: Boolean,
  square: Boolean,
  loading: Boolean,
  hairline: Boolean,
  disabled: Boolean,
  iconPrefix: String,
  nativeType: makeStringProp("button"),
  loadingSize: numericProp,
  loadingText: String,
  // loadingType: String as PropType<LoadingType>,
  iconPosition: makeStringProp("left")
});
const __default__$6 = defineComponent({
  name: name$4,
  props: buttonProps,
  emits: ["click"],
  setup(props, {
    emit,
    slots
  }) {
    const route2 = useRoute();
    const renderLoadingIcon = () => {
      if (slots.loading) {
        return slots.loading();
      }
      return createVNode(CircleLoadingIcon, {
        "width": 24,
        "height": 24
      }, null);
    };
    const renderIcon = () => {
      if (props.loading) {
        return renderLoadingIcon();
      }
      if (slots.icon) {
        return createVNode("div", {
          "class": bem$4("icon")
        }, [slots.icon()]);
      }
      if (props.icon) {
        return createVNode(Fragment, null, [createTextVNode("icon todo")]);
      }
    };
    const renderText = () => {
      let text;
      if (props.loading) {
        text = props.loadingText;
      } else {
        text = slots.default ? slots.default() : props.text;
      }
      return text ? createVNode("span", {
        "class": bem$4("text")
      }, [text]) : void 0;
    };
    const getStyle = () => {
      const {
        color,
        plain
      } = props;
      if (color) {
        const style2 = {
          color: plain ? color : "white"
        };
        if (!plain) {
          style2.background = color;
        }
        if (color.includes("gradient")) {
          style2.border = 0;
        } else {
          style2.borderColor = color;
        }
        return style2;
      }
    };
    const onClick = (event) => {
      if (props.loading) {
        preventDefault(event);
      } else if (!props.disabled) {
        emit("click", event);
        route2();
      }
    };
    return () => {
      const {
        tag,
        type,
        size,
        block,
        round,
        plain,
        square,
        loading,
        disabled,
        hairline,
        nativeType,
        iconPosition
      } = props;
      const classes = [bem$4([type, size, {
        plain,
        block,
        round,
        square,
        loading,
        disabled,
        hairline
      }]), {
        [BORDER_SURROUND]: hairline
      }];
      return createVNode(tag, {
        "type": nativeType,
        "class": classes,
        "style": getStyle(),
        "disabled": disabled,
        "onClick": onClick
      }, {
        default: () => [createVNode("div", {
          "class": bem$4("content")
        }, [iconPosition === "left" && renderIcon(), renderText(), iconPosition === "right" && renderIcon()])]
      });
    };
  }
});
const __moduleId$6 = "src/components/global/button/Button.tsx";
ssrRegisterHelper(__default__$6, __moduleId$6);
const Button = withInstall(__default__$6);
const ClientOnly = defineComponent({
  setup(_2, { slots }) {
    const show = ref(false);
    onMounted(() => {
      show.value = true;
    });
    return () => show.value && slots.default ? slots.default() : null;
  }
});
const popupSharedProps = {
  // whether to show popup
  show: Boolean,
  // z-index
  zIndex: numericProp,
  // whether to show overlay
  overlay: truthProp,
  // transition duration
  duration: numericProp,
  // teleport
  teleport: [String, Object],
  // prevent body scroll
  lockScroll: truthProp,
  // whether to lazy render
  lazyRender: truthProp,
  // callback function before close
  beforeClose: Function,
  // overlay custom style
  overlayStyle: Object,
  // overlay custom class name
  overlayClass: unknownProp,
  // Initial rendering animation
  transitionAppear: Boolean,
  // whether to close popup when overlay is clicked
  closeOnClickOverlay: truthProp
};
const popupSharedPropKeys = Object.keys(popupSharedProps);
const index$3 = "";
const popupProps = extend$1({}, popupSharedProps, {
  round: Boolean,
  position: makeStringProp("center"),
  closeIcon: makeStringProp("cross"),
  closeable: Boolean,
  transition: String,
  iconPrefix: String,
  closeOnPopstate: Boolean,
  closeIconPosition: makeStringProp("top-right"),
  safeAreaInsetTop: Boolean,
  safeAreaInsetBottom: Boolean
});
const __default__$5 = defineComponent({
  name: "PatPopup",
  inheritAttrs: false,
  props: popupProps,
  emits: ["open", "close", "opened", "closed", "keydown", "update:show", "clickOverlay", "clickCloseIcon"],
  setup(props, {
    emit,
    attrs,
    slots
  }) {
    let opened;
    let shouldReopen;
    const zIndex = ref();
    const popupRef = ref();
    const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
    const style2 = computed(() => {
      const style3 = {
        zIndex: zIndex.value
      };
      if (isDef(props.duration)) {
        const key = props.position === "center" ? "animationDuration" : "transitionDuration";
        style3[key] = `${props.duration}s`;
      }
      return style3;
    });
    const open = () => {
      if (!opened) {
        opened = true;
        zIndex.value = props.zIndex !== void 0 ? +props.zIndex : useGlobalZIndex();
        emit("open");
      }
    };
    const close = () => {
      if (opened) {
        callInterceptor(props.beforeClose, {
          done() {
            opened = false;
            emit("close");
            emit("update:show", false);
          }
        });
      }
    };
    const onClickOverlay = (event) => {
      emit("clickOverlay", event);
      if (props.closeOnClickOverlay) {
        close();
      }
    };
    const renderOverlay = () => {
      return props.overlay ? createVNode(Overlay, {
        "show": props.show,
        "class": props.overlayClass,
        "zIndex": zIndex.value,
        "duration": props.duration,
        "customStyle": props.overlayStyle,
        "role": props.closeOnClickOverlay ? "button" : void 0,
        "tabindex": props.closeOnClickOverlay ? 0 : void 0,
        "onClick": onClickOverlay
      }, {
        default: slots["overlay-content"]
      }) : null;
    };
    const renderCloseIcon = () => {
      return props.closeable ? createVNode("div", null, [createTextVNode("Close Icon")]) : (
        // <Icon
        //   role="button"
        //   tabindex={0}
        //   name={props.closeIcon}
        //   class={[
        //     bem("close-icon", props.closeIconPosition),
        //     HAPTICS_FEEDBACK
        //   ]}
        //   classPrefix={props.iconPrefix}
        //   onClick={onClickCloseIcon}
        // />
        null
      );
    };
    const onOpened = () => emit("opened");
    const onClosed = () => emit("closed");
    const onKeydown = (event) => emit("keydown", event);
    const renderPopup = lazyRender(() => {
      var _a;
      const {
        round,
        position,
        safeAreaInsetTop,
        safeAreaInsetBottom
      } = props;
      return withDirectives(createVNode("div", mergeProps({
        "ref": popupRef,
        "style": style2.value,
        "role": "dialog",
        "tabindex": 0,
        "class": ["pat-popup", {
          "pat-popup--top": position && position === "top",
          "pat-popup--left": position && position === "left",
          "pat-popup--right": position && position === "right",
          "pat-popup--bottom": position && position === "bottom",
          "pat-popup--center": position && position === "center",
          "pat-popup--round": round,
          "pat-safe-area-top": safeAreaInsetTop,
          "pat-safe-area-bottom": safeAreaInsetBottom
        }],
        "onKeydown": onKeydown
      }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vShow, props.show]]);
    });
    const renderTransition = () => {
      const {
        position,
        transition,
        transitionAppear
      } = props;
      const name2 = position === "center" ? "pat-fade" : `pat-popup-slide-${position}`;
      return createVNode(Transition, {
        "name": transition || name2,
        "appear": transitionAppear,
        "onAfterEnter": onOpened,
        "onAfterLeave": onClosed
      }, {
        default: renderPopup
      });
    };
    watch(() => props.show, (show) => {
      if (show && !opened) {
        open();
        if (attrs.tabindex === 0) {
          nextTick(() => {
            var _a;
            (_a = popupRef.value) == null ? void 0 : _a.focus();
          });
        }
      }
      if (!show && opened) {
        opened = false;
        emit("close");
      }
    });
    useExpose({
      popupRef
    });
    useLockScroll(popupRef, () => props.show && props.lockScroll);
    useEventListener("popstate", () => {
      if (props.closeOnPopstate) {
        close();
        shouldReopen = false;
      }
    });
    onMounted(() => {
      if (props.show) {
        open();
      }
    });
    onActivated(() => {
      if (shouldReopen) {
        emit("update:show", true);
        shouldReopen = false;
      }
    });
    onDeactivated(() => {
      if (props.show && props.teleport) {
        close();
        shouldReopen = true;
      }
    });
    provide(POPUP_TOGGLE_KEY, () => props.show);
    return () => {
      if (props.teleport) {
        return createVNode(Teleport, {
          "to": props.teleport
        }, {
          default: () => [renderOverlay(), renderTransition()]
        });
      }
      return createVNode(Fragment, null, [renderOverlay(), renderTransition()]);
    };
  }
});
const __moduleId$5 = "src/components/global/popup/Popup.tsx";
ssrRegisterHelper(__default__$5, __moduleId$5);
const Popup = withInstall(__default__$5);
const useHeight = (element, withSafeArea) => {
  const height = ref();
  const setHeight = () => {
    height.value = useRect(element).height;
  };
  onMounted(() => {
    nextTick(setHeight);
    if (withSafeArea) {
      for (let i = 1; i <= 3; i++) {
        setTimeout(setHeight, 100 * i);
      }
    }
  });
  onPopupReopen(() => nextTick(setHeight));
  return height;
};
function usePlaceholder(contentRef, bem2) {
  const height = useHeight(contentRef, true);
  return (renderContent) => createVNode("div", {
    "class": bem2("placeholder"),
    "style": {
      height: height.value ? `${height.value}px` : void 0
    }
  }, [renderContent()]);
}
const [name$3, bem$3] = createNamespace("action-bar");
const ACTION_BAR_KEY = Symbol(name$3);
const actionBarProps = {
  placeholder: Boolean,
  safeAreaInsetBottom: truthProp
};
const __default__$4 = defineComponent({
  name: name$3,
  props: actionBarProps,
  setup(props, {
    slots
  }) {
    const root = ref();
    const renderPlaceholder = usePlaceholder(root, bem$3);
    const {
      linkChildren
    } = useChildren(ACTION_BAR_KEY);
    linkChildren();
    const renderActionBar = () => {
      var _a;
      return createVNode("div", {
        "ref": root,
        "class": [bem$3(), {
          "pat-safe-area-bottom": props.safeAreaInsetBottom
        }]
      }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
    };
    return () => {
      if (props.placeholder) {
        return renderPlaceholder(renderActionBar);
      }
      return renderActionBar();
    };
  }
});
const __moduleId$4 = "src/components/global/action-bar/ActionBar.tsx";
ssrRegisterHelper(__default__$4, __moduleId$4);
const ActionBar = withInstall(__default__$4);
const [name$2, bem$2] = createNamespace("action-bar-button");
const actionBarButtonProps = extend$1({}, routeProps, {
  type: String,
  text: String,
  icon: String,
  color: String,
  loading: Boolean,
  disabled: Boolean
});
const __default__$3 = defineComponent({
  name: name$2,
  props: actionBarButtonProps,
  setup(props, {
    slots
  }) {
    const route2 = useRoute();
    const {
      parent,
      index: index2
    } = useParent(ACTION_BAR_KEY);
    const isFirst = computed(() => {
      if (parent) {
        const prev = parent.children[index2.value - 1];
        return !(prev && "isButton" in prev);
      }
      return void 0;
    });
    const isLast = computed(() => {
      if (parent) {
        const next = parent.children[index2.value + 1];
        return !(next && "isButton" in next);
      }
      return void 0;
    });
    useExpose({
      isButton: true
    });
    return () => {
      const {
        type,
        icon,
        text,
        color,
        loading,
        disabled
      } = props;
      return createVNode(Button, {
        "class": bem$2([type, {
          last: isLast.value,
          first: isFirst.value
        }]),
        "size": "large",
        "type": type,
        "icon": icon,
        "color": color,
        "loading": loading,
        "disabled": disabled,
        "onClick": route2
      }, {
        default: () => [slots.default ? slots.default() : text]
      });
    };
  }
});
const __moduleId$3 = "src/components/global/action-bar-button/ActionBarButton.tsx";
ssrRegisterHelper(__default__$3, __moduleId$3);
const ActionBarButton = withInstall(__default__$3);
const index$2 = "";
const dialogProps = extend$1({}, popupSharedProps, {
  title: String,
  theme: String,
  width: numericProp,
  message: [String, Function],
  callback: Function,
  allowHtml: Boolean,
  className: unknownProp,
  transition: makeStringProp("pat-dialog-bounce"),
  messageAlign: String,
  closeOnPopstate: truthProp,
  showCancelButton: Boolean,
  cancelButtonText: String,
  cancelButtonColor: String,
  cancelButtonDisabled: Boolean,
  confirmButtonText: String,
  confirmButtonColor: String,
  confirmButtonDisabled: Boolean,
  showConfirmButton: truthProp,
  closeOnClickOverlay: Boolean
});
const popupInheritKeys = [...popupSharedPropKeys, "transition", "closeOnPopstate"];
const __default__$2 = defineComponent({
  name: "PatDialog",
  props: dialogProps,
  emits: ["confirm", "cancel", "keydown", "update:show"],
  setup(props, {
    emit,
    slots
  }) {
    const root = ref();
    const loading = reactive({
      confirm: false,
      cancel: false
    });
    const updateShow = (value) => emit("update:show", value);
    const close = (action) => {
      var _a;
      updateShow(false);
      (_a = props.callback) == null ? void 0 : _a.call(props, action);
    };
    const getActionHandler = (action) => () => {
      if (!props.show) {
        return;
      }
      emit(action);
      if (props.beforeClose) {
        loading[action] = true;
        callInterceptor(props.beforeClose, {
          args: [action],
          done() {
            close(action);
            loading[action] = false;
          },
          canceled() {
            loading[action] = false;
          }
        });
      } else {
        close(action);
      }
    };
    const onCancel = getActionHandler("cancel");
    const onConfirm = getActionHandler("confirm");
    const onKeydown = withKeys((event) => {
      var _a, _b;
      if (event.target !== ((_b = (_a = root.value) == null ? void 0 : _a.popupRef) == null ? void 0 : _b.value)) {
        return;
      }
      const onEventType = {
        Enter: props.showConfirmButton ? onConfirm : noop$1,
        Escape: props.showCancelButton ? onCancel : noop$1
      };
      onEventType[event.key]();
      emit("keydown", event);
    }, ["enter", "esc"]);
    const renderTitle = () => {
      const title = slots.title ? slots.title() : props.title;
      return title ? createVNode("div", {
        "class": ["pat-dialog__header", {
          "pat-dialog__isolated": !props.message && !slots.default
        }]
      }, [title]) : null;
    };
    const renderMessage = (hasTitle) => {
      const {
        message,
        allowHtml,
        messageAlign
      } = props;
      const key = `pat-dialog__${messageAlign}`;
      const classNames = ["pat-dialog__message", {
        "pat-dialog__has-title": hasTitle,
        [key]: messageAlign
      }];
      const content = isFunction(message) ? message() : message;
      if (allowHtml && typeof content === "string") {
        return createVNode("div", {
          "class": classNames,
          "innerHTML": content
        }, null);
      }
      return createVNode("div", {
        "class": classNames
      }, [content]);
    };
    const renderContent = () => {
      if (slots.default) {
        return createVNode("div", {
          "class": "pat-dialog__content"
        }, [slots.default()]);
      }
      const {
        title,
        message,
        allowHtml
      } = props;
      if (message) {
        const hasTitle = !!(title || slots.title);
        return createVNode("div", {
          "key": allowHtml ? 1 : 0,
          "class": ["pat-dialog__content", {
            "pat-dialog__isolated": !hasTitle
          }]
        }, [renderMessage(hasTitle)]);
      }
      return null;
    };
    const renderButtons = () => createVNode("div", {
      "class": [BORDER_TOP, "pat-dialog__footer"]
    }, [props.showCancelButton && createVNode(Button, {
      "size": "large",
      "text": props.cancelButtonText,
      "class": "pat-dialog__cancel",
      "style": {
        color: props.cancelButtonColor
      },
      "loading": loading.cancel,
      "disabled": props.cancelButtonDisabled,
      "onClick": onCancel
    }, null), props.showConfirmButton && createVNode(Button, {
      "size": "large",
      "text": props.confirmButtonText,
      "class": ["pat-dialog__confirm", {
        [BORDER_LEFT]: props.showCancelButton
      }],
      "style": {
        color: props.confirmButtonColor
      },
      "loading": loading.confirm,
      "disabled": props.confirmButtonDisabled,
      "onClick": onConfirm
    }, null)]);
    const renderRoundButtons = () => createVNode(ActionBar, {
      "class": "pat-dialog__footer"
    }, {
      default: () => [props.showCancelButton && createVNode(ActionBarButton, {
        "type": "white",
        "text": props.cancelButtonText,
        "class": "pat-dialog__cancel",
        "color": props.cancelButtonColor,
        "loading": loading.cancel,
        "disabled": props.cancelButtonDisabled,
        "onClick": onCancel
      }, null), props.showConfirmButton && createVNode(ActionBarButton, {
        "type": "gray",
        "text": props.confirmButtonText,
        "class": "pat-dialog__confirm",
        "color": props.confirmButtonColor,
        "loading": loading.confirm,
        "disabled": props.confirmButtonDisabled,
        "onClick": onConfirm
      }, null)]
    });
    const renderFooter = () => {
      if (slots.footer) {
        return slots.footer();
      }
      return props.theme === "round-button" ? renderRoundButtons() : renderButtons();
    };
    return () => {
      const {
        width,
        title,
        theme,
        message,
        className
      } = props;
      return createVNode(Popup, mergeProps({
        "ref": root,
        "role": "dialog",
        "class": ["pat-dialog", `pat-dialog__${theme}`, className],
        "style": {
          width: addUnit(width)
        },
        "tabindex": 0,
        "aria-labelledby": title || message,
        "onKeydown": onKeydown,
        "onUpdate:show": updateShow
      }, pick(props, popupInheritKeys)), {
        default: () => [renderTitle(), renderContent(), renderFooter()]
      });
    };
  }
});
const __moduleId$2 = "src/components/global/dialog/Dialog.tsx";
ssrRegisterHelper(__default__$2, __moduleId$2);
const DEFAULT_OPTIONS = {
  title: "",
  width: "",
  theme: null,
  message: "",
  overlay: true,
  callback: null,
  teleport: "body",
  className: "",
  allowHtml: false,
  lockScroll: true,
  transition: void 0,
  beforeClose: null,
  overlayClass: "",
  overlayStyle: void 0,
  messageAlign: "",
  cancelButtonText: "",
  cancelButtonColor: null,
  cancelButtonDisabled: false,
  confirmButtonText: "",
  confirmButtonColor: null,
  confirmButtonDisabled: false,
  showConfirmButton: true,
  showCancelButton: false,
  closeOnPopstate: true,
  closeOnClickOverlay: false
};
extend$1({}, DEFAULT_OPTIONS);
const Dialog = withInstall(__default__$2);
const index$1 = "";
const [name$1, bem$1] = createNamespace("swipe");
const swipeProps = {
  loop: truthProp,
  width: numericProp,
  height: numericProp,
  vertical: Boolean,
  autoplay: makeNumericProp(0),
  duration: makeNumericProp(500),
  touchable: truthProp,
  lazyRender: Boolean,
  initialSwipe: makeNumericProp(0),
  indicatorColor: String,
  showIndicators: truthProp,
  stopPropagation: truthProp
};
const SWIPE_KEY = Symbol(name$1);
const __default__$1 = defineComponent({
  name: name$1,
  props: swipeProps,
  emits: ["change", "dragStart", "dragEnd"],
  setup(props, {
    emit,
    slots
  }) {
    const root = ref();
    const track2 = ref();
    const state = reactive({
      rect: null,
      width: 0,
      height: 0,
      offset: 0,
      active: 0,
      swiping: false
    });
    let dragging = false;
    const mainStore = useMainStore();
    const touch = useTouch();
    const {
      children,
      linkChildren
    } = useChildren(SWIPE_KEY);
    const count = computed(() => children.length);
    const size = computed(() => state[props.vertical ? "height" : "width"]);
    const delta = computed(() => props.vertical ? touch.deltaY.value : touch.deltaX.value);
    const isHorizontalRtl = computed(() => !props.vertical && mainStore.isRtl);
    const minOffset = computed(() => {
      if (state.rect) {
        const base = props.vertical ? state.rect.height : state.rect.width;
        return base - size.value * count.value;
      }
      return 0;
    });
    const maxCount = computed(() => size.value ? Math.ceil(Math.abs(minOffset.value) / size.value) : count.value);
    const trackSize = computed(() => count.value * size.value);
    const activeIndicator = computed(() => (state.active + count.value) % count.value);
    const isCorrectDirection = computed(() => {
      const expect = props.vertical ? "vertical" : "horizontal";
      return touch.direction.value === expect;
    });
    const trackStyle = computed(() => {
      const style2 = {
        transitionDuration: `${state.swiping ? 0 : props.duration}ms`,
        transform: `translate${props.vertical ? "Y" : "X"}(${state.offset}px)`
      };
      if (size.value) {
        const mainAxis = props.vertical ? "height" : "width";
        const crossAxis = props.vertical ? "width" : "height";
        style2[mainAxis] = `${trackSize.value}px`;
        style2[crossAxis] = props[crossAxis] ? `${props[crossAxis]}px` : "";
      }
      return style2;
    });
    const getTargetActive = (pace) => {
      const {
        active
      } = state;
      if (pace) {
        if (props.loop) {
          return clamp(active + pace, -1, count.value);
        }
        return clamp(active + pace, 0, maxCount.value);
      }
      return active;
    };
    const getTargetOffset = (targetActive, offset = 0) => {
      let currentPosition = targetActive * size.value;
      if (!props.loop) {
        currentPosition = Math.min(currentPosition, -minOffset.value);
      }
      let targetOffset = offset - currentPosition;
      if (!props.loop) {
        targetOffset = clamp(targetOffset, minOffset.value, 0);
      }
      return targetOffset;
    };
    const move = ({
      pace = 0,
      offset = 0,
      emitChange
    }) => {
      var _a;
      if (count.value <= 1) {
        return;
      }
      const {
        active
      } = state;
      const targetActive = getTargetActive(pace);
      const targetOffset = getTargetOffset(targetActive, offset);
      if (props.loop) {
        if (children[0] && targetOffset !== minOffset.value) {
          const outRightBound = targetOffset < minOffset.value;
          children[0].setOffset(outRightBound ? trackSize.value : 0);
        }
        if (children[count.value - 1] && targetOffset !== 0) {
          const outLeftBound = targetOffset > 0;
          (_a = children[count.value - 1]) == null ? void 0 : _a.setOffset(outLeftBound ? -trackSize.value : 0);
        }
      }
      state.active = targetActive;
      state.offset = targetOffset;
      if (emitChange && targetActive !== active) {
        emit("change", activeIndicator.value);
      }
    };
    const correctPosition = () => {
      state.swiping = true;
      if (state.active <= -1) {
        move({
          pace: count.value
        });
      } else if (state.active >= count.value) {
        move({
          pace: -count.value
        });
      }
    };
    const prev = () => {
      correctPosition();
      touch.reset();
      doubleRaf(() => {
        state.swiping = false;
        move({
          pace: -1,
          emitChange: true
        });
      });
    };
    const next = () => {
      correctPosition();
      touch.reset();
      doubleRaf(() => {
        state.swiping = false;
        move({
          pace: 1,
          emitChange: true
        });
      });
    };
    let autoplayTimer;
    const stopAutoplay = () => clearTimeout(autoplayTimer);
    const autoplay = () => {
      stopAutoplay();
      if (Number(props.autoplay) > 0 && count.value > 1) {
        autoplayTimer = setTimeout(() => {
          next();
          autoplay();
        }, +props.autoplay);
      }
    };
    const initialize = (active = +props.initialSwipe) => {
      if (!root.value) {
        return;
      }
      const cb = () => {
        if (!isHidden(root)) {
          const rect = {
            width: root.value.offsetWidth,
            height: root.value.offsetHeight
          };
          state.rect = rect;
          state.width = +(props.width ?? rect.width);
          state.height = +(props.height ?? rect.height);
        }
        if (count.value) {
          active = Math.min(count.value - 1, active);
          if (active === -1) {
            active = count.value - 1;
          }
        }
        state.active = active;
        state.swiping = true;
        state.offset = getTargetOffset(active);
        children.forEach((swipe) => {
          swipe.setOffset(0);
        });
        autoplay();
      };
      if (isHidden(root)) {
        nextTick().then(cb);
      } else {
        cb();
      }
    };
    const resize = () => initialize(state.active);
    let touchStartTime;
    const onTouchStart = (event) => {
      if (!props.touchable || // avoid resetting position on multi-finger touch
      event.touches.length > 1)
        return;
      touch.start(event);
      dragging = false;
      touchStartTime = Date.now();
      stopAutoplay();
      correctPosition();
    };
    const onTouchMove = (event) => {
      if (props.touchable && state.swiping) {
        touch.move(event);
        if (isCorrectDirection.value) {
          const isEdgeTouch = !props.loop && (state.active === 0 && delta.value > 0 || state.active === count.value - 1 && delta.value < 0);
          if (!isEdgeTouch) {
            preventDefault(event, props.stopPropagation);
            move({
              offset: delta.value
            });
            if (!dragging) {
              emit("dragStart");
              dragging = true;
            }
          }
        }
      }
    };
    const onTouchEnd = () => {
      if (!props.touchable || !state.swiping) {
        return;
      }
      const duration = Date.now() - touchStartTime;
      const speed = delta.value / duration;
      const shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta.value) > size.value / 2;
      if (shouldSwipe && isCorrectDirection.value) {
        const offset = props.vertical ? touch.offsetY.value : touch.offsetX.value;
        let pace = 0;
        if (props.loop) {
          pace = offset > 0 ? delta.value > 0 ? -1 : 1 : 0;
        } else {
          pace = -Math[delta.value > 0 ? "ceil" : "floor"](delta.value / size.value);
        }
        move({
          pace,
          emitChange: true
        });
      } else if (delta.value) {
        move({
          pace: 0
        });
      }
      dragging = false;
      state.swiping = false;
      emit("dragEnd");
      autoplay();
    };
    const swipeTo = (index2, options = {}) => {
      correctPosition();
      touch.reset();
      doubleRaf(() => {
        let targetIndex;
        if (props.loop && index2 === count.value) {
          targetIndex = state.active === 0 ? 0 : index2;
        } else {
          targetIndex = index2 % count.value;
        }
        if (options.immediate) {
          doubleRaf(() => {
            state.swiping = false;
          });
        } else {
          state.swiping = false;
        }
        move({
          pace: targetIndex - state.active,
          emitChange: true
        });
      });
    };
    const renderDot = (_2, index2) => {
      const active = index2 === activeIndicator.value;
      const style2 = active ? {
        backgroundColor: props.indicatorColor
      } : void 0;
      return createVNode("i", {
        "style": style2,
        "class": bem$1("indicator", {
          active
        })
      }, null);
    };
    const renderIndicator = () => {
      if (slots.indicator) {
        return slots.indicator({
          active: activeIndicator.value,
          total: count.value
        });
      }
      if (props.showIndicators && count.value > 1) {
        return createVNode("div", {
          "class": bem$1("indicators", {
            vertical: props.vertical
          })
        }, [Array(count.value).fill("").map(renderDot)]);
      }
      return null;
    };
    useExpose({
      prev,
      next,
      state,
      resize,
      swipeTo
    });
    linkChildren({
      size,
      props,
      count,
      activeIndicator
    });
    watch(() => props.initialSwipe, (value) => initialize(+value));
    watch(count, () => initialize(state.active));
    watch(() => props.autoplay, autoplay);
    watch([windowWidth, windowHeight], resize);
    watch(usePageVisibility(), (visible) => {
      if (visible === "visible") {
        autoplay();
      } else {
        stopAutoplay();
      }
    });
    onMounted(initialize);
    onActivated(() => initialize(state.active));
    onPopupReopen(() => initialize(state.active));
    onDeactivated(stopAutoplay);
    onBeforeUnmount(stopAutoplay);
    useEventListener("touchmove", onTouchMove, {
      target: track2
    });
    return () => {
      var _a;
      return createVNode("div", {
        "ref": root,
        "class": bem$1(),
        "style": isHorizontalRtl.value ? "direction: ltr;" : ""
      }, [createVNode("div", {
        "ref": track2,
        "style": trackStyle.value,
        "class": bem$1("track", {
          vertical: props.vertical
        }),
        "onTouchstartPassive": onTouchStart,
        "onTouchend": onTouchEnd,
        "onTouchcancel": onTouchEnd
      }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), renderIndicator()]);
    };
  }
});
const __moduleId$1 = "src/components/global/swipe/Swipe.tsx";
ssrRegisterHelper(__default__$1, __moduleId$1);
const index = "";
const [name, bem] = createNamespace("swipe-item");
const __default__ = defineComponent({
  name,
  setup(props, {
    slots
  }) {
    let rendered;
    const state = reactive({
      offset: 0,
      inited: false,
      mounted: false
    });
    const {
      parent,
      index: index2
    } = useParent(SWIPE_KEY);
    if (!parent) {
      if (process.env.NODE_ENV !== "production") {
        console.error("[Pat] <PatSwipeItem> must be a child component of <PatSwipe>.");
      }
      return;
    }
    const style2 = computed(() => {
      const style3 = {};
      const {
        vertical
      } = parent.props;
      if (parent.size.value) {
        style3[vertical ? "height" : "width"] = `${parent.size.value}px`;
      }
      if (state.offset) {
        style3.transform = `translate${vertical ? "Y" : "X"}(${state.offset}px)`;
      }
      return style3;
    });
    const shouldRender = computed(() => {
      const {
        loop,
        lazyRender
      } = parent.props;
      if (!lazyRender || rendered) {
        return true;
      }
      if (!state.mounted) {
        return false;
      }
      const active = parent.activeIndicator.value;
      const maxActive = parent.count.value - 1;
      const prevActive = active === 0 && loop ? maxActive : active - 1;
      const nextActive = active === maxActive && loop ? 0 : active + 1;
      rendered = index2.value === active || index2.value === prevActive || index2.value === nextActive;
      return rendered;
    });
    const setOffset = (offset) => {
      state.offset = offset;
    };
    onMounted(() => {
      nextTick(() => {
        state.mounted = true;
      });
    });
    useExpose({
      setOffset
    });
    return () => {
      var _a;
      return createVNode("div", {
        "class": bem(),
        "style": style2.value
      }, [shouldRender.value ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null]);
    };
  }
});
const __moduleId = "src/components/global/swipeItem/SwipeItem.tsx";
ssrRegisterHelper(__default__, __moduleId);
const SwipeItem = withInstall(__default__);
const Swipe = withInstall(__default__$1);
const createApp = () => {
  const app = createSSRApp(_sfc_main);
  const pinia = createPinia();
  app.use(pinia);
  app.directive("track", track);
  const i18n2 = setupI18n({
    legacy: false,
    locale: "en",
    fallbackLocale: "en",
    messages: {
      en
    }
  });
  app.use(i18n2);
  const router = createRouter(i18n2);
  app.use(router);
  app.use(Lazyload, lazyImageFilter);
  app.component("PImage", Image$1);
  app.component("PatButton", Button);
  app.component("PatLink", __default__$a);
  app.use(SwipeItem);
  app.use(Swipe);
  app.component("ClientOnly", ClientOnly);
  app.use(Dialog);
  return { app, router, pinia };
};
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const resolve = (...p) => path.resolve(__dirname, ...p);
const render = async (url, manifest, ssrContext) => {
  const { app, router, pinia } = createApp();
  await router.push(url);
  await router.isReady();
  const renderCtx = ssrContext;
  const renderedHtml = await renderToString(app, renderCtx);
  const state = JSON.stringify(pinia.state.value);
  const { preloadLinks, cssCollect } = await renderPreloadLinks(renderCtx.modules, manifest);
  return [renderedHtml, state, preloadLinks, cssCollect.join("\n")];
};
async function renderPreloadLinks(modules, manifest) {
  let preloadLinks = "";
  const seen = /* @__PURE__ */ new Set();
  const cssCollect = [];
  modules.forEach((id) => {
    const files = manifest[id];
    if (files) {
      files.forEach((file) => {
        if (!seen.has(file)) {
          seen.add(file);
          if (file.endsWith(".css")) {
            cssCollect.push(readFile(resolve("../client/assets/", path.basename(file)), { encoding: "utf-8" }));
          }
          const filename = path.basename(file);
          if (manifest[filename]) {
            for (const depFile of manifest[filename]) {
              preloadLinks += renderPreloadLink(depFile);
              seen.add(depFile);
            }
          }
          preloadLinks += renderPreloadLink(file);
        }
      });
    }
  });
  try {
    const result = await Promise.all(cssCollect);
    return { preloadLinks, cssCollect: result };
  } catch (error) {
    return { preloadLinks, cssCollect: [] };
  }
}
function renderPreloadLink(file) {
  if (file.endsWith(".js")) {
    return `<link rel="modulepreload" crossorigin href="${file}">`;
  } else if (file.endsWith(".css")) {
    return `<link rel="stylesheet" href="${file}">`;
  } else if (file.endsWith(".woff")) {
    return ` <link rel="preload" href="${file}" as="font" type="font/woff" crossorigin>`;
  } else if (file.endsWith(".woff2")) {
    return ` <link rel="preload" href="${file}" as="font" type="font/woff2" crossorigin>`;
  } else if (file.endsWith(".gif")) {
    return ` <link rel="preload" href="${file}" as="image" type="image/gif">`;
  } else if (file.endsWith(".jpg") || file.endsWith(".jpeg")) {
    return ` <link rel="preload" href="${file}" as="image" type="image/jpeg">`;
  } else if (file.endsWith(".png")) {
    return ` <link rel="preload" href="${file}" as="image" type="image/png">`;
  } else {
    return "";
  }
}
export {
  getContactUsListApi as $,
  AppLayout as A,
  useUserInfoStore as B,
  CircleLoadingIcon as C,
  getCountryShippingInfoApi as D,
  renderComponent as E,
  replaceImageSrcToCdnUrl as F,
  getCookie as G,
  HelpCenterHeader as H,
  IconWrapper as I,
  getCustomerServiceInfo as J,
  getLocalStore as K,
  useMountedHook as L,
  MessageDialog as M,
  getUnreadMsgCountApi as N,
  OrderIcon as O,
  PlusIcon as P,
  CloseIcon as Q,
  Image$1 as R,
  SearchIcon as S,
  transformUTCToLocal as T,
  getUserOrderListApi as U,
  postSubmitTicketApi as V,
  submitCompleteRoute as W,
  replyCaseApi as X,
  getHelpCenterListApi as Y,
  getHelpCenterDetailApi as Z,
  _export_sfc as _,
  unitToPx as a,
  exitAppWebPage as a0,
  getHelpCenterResultListApi as a1,
  ticketDetailRoute as a2,
  uctTime as a3,
  getLocalUtcDate as a4,
  postSolvedCaseApi as a5,
  replyTicketRoute as a6,
  getCaseReplyDetailsApi as a7,
  Popup as a8,
  pick as a9,
  createNamespace as aa,
  makeNumberProp as ab,
  unknownProp as ac,
  isDef as ad,
  extend$1 as ae,
  withInstall as af,
  api$1 as ag,
  discountCalculation as ah,
  appendClickTrackData as ai,
  useEventListener as b,
  makeNumericProp as c,
  isHidden$1 as d,
  extend as e,
  useRect as f,
  getZIndexStyle$1 as g,
  getScrollTop as h,
  inBrowser$1 as i,
  useTrack as j,
  helpCenterRoute as k,
  useNativeInfoStore as l,
  makeStringProp as m,
  numericProp as n,
  onMountedOrActivated as o,
  useMainStore as p,
  cdnUrl as q,
  helpCenterDetailRoute as r,
  render,
  ssrRegisterHelper as s,
  ArrowLeftIcon as t,
  useScrollParent as u,
  ArrowRightIcon as v,
  base64Encode as w,
  helpSearchResultRoute as x,
  navNativePage as y,
  useL10n as z
};
